Schema not added to FK constraints
Hi!
I'm trying to use drizzle with MySQL. I have a mysqlSchema that I made and then am trying to create a FK but the generated SQL doesn't include the schema.
Generated:
Am I doing something wrong?
I'm trying to use drizzle with MySQL. I have a mysqlSchema that I made and then am trying to create a FK but the generated SQL doesn't include the schema.
export const mySchema = mysqlSchema('my')
export const categories = mySchema.table('categories', {
id: tinyint('id').primaryKey(),
name: varchar('name', { length: 256 }).notNull(),
})
export const items = mySchema.table('items', {
id: int('item_id').notNull().primaryKey(),
name: varchar('name', { length: 256 }).notNull(),
category: tinyint('category')
.notNull()
.references(() => categories.id, {
onDelete: 'cascade',
})
})export const mySchema = mysqlSchema('my')
export const categories = mySchema.table('categories', {
id: tinyint('id').primaryKey(),
name: varchar('name', { length: 256 }).notNull(),
})
export const items = mySchema.table('items', {
id: int('item_id').notNull().primaryKey(),
name: varchar('name', { length: 256 }).notNull(),
category: tinyint('category')
.notNull()
.references(() => categories.id, {
onDelete: 'cascade',
})
})Generated:
CREATE DATABASE `my`;
CREATE TABLE `my`.`categories` (
`id` tinyint PRIMARY KEY NOT NULL,
`name` varchar(256) NOT NULL);
CREATE TABLE `my`.`items` (
`item_id` int PRIMARY KEY NOT NULL,
`name` varchar(256) NOT NULL,
`category` tinyint NOT NULL);
ALTER TABLE `items` ADD CONSTRAINT `items_category_categories_id_fk` FOREIGN KEY (`category`) REFERENCES `categories`(`id`) ON DELETE cascade ON UPDATE no action;CREATE DATABASE `my`;
CREATE TABLE `my`.`categories` (
`id` tinyint PRIMARY KEY NOT NULL,
`name` varchar(256) NOT NULL);
CREATE TABLE `my`.`items` (
`item_id` int PRIMARY KEY NOT NULL,
`name` varchar(256) NOT NULL,
`category` tinyint NOT NULL);
ALTER TABLE `items` ADD CONSTRAINT `items_category_categories_id_fk` FOREIGN KEY (`category`) REFERENCES `categories`(`id`) ON DELETE cascade ON UPDATE no action;Am I doing something wrong?