Closed pedro757 closed 1 month ago
This should be fixed in drizzle-kit@0.24.1
If you still encounter this issue, please reopen the ticket
Still an issue in drizzle-kit@0.24.1
@AndriiSherman
BTW, I can't reopen the issue
Still an issue in
drizzle-kit@0.24.1
@AndriiShermanBTW, I can't reopen the issue
can you send me a create statement for your table, so I can reproduce it. Because running tests on names for indexes on introspect was working well for me
@AndriiSherman
CREATE TABLE `Entity` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=385 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `EntityTag` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `_EntityToEntityTag` (
`A` int NOT NULL,
`B` int NOT NULL,
UNIQUE KEY `_EntityToEntityTag_AB_unique` (`A`,`B`),
KEY `_EntityToEntityTag_B_index` (`B`),
CONSTRAINT `_EntityToEntityTag_A_fkey` FOREIGN KEY (`A`) REFERENCES `Entity` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `_EntityToEntityTag_B_fkey` FOREIGN KEY (`B`) REFERENCES `EntityTag` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
outputs
import { mysqlTable, mysqlSchema, AnyMySqlColumn, primaryKey, int, varchar, index, foreignKey, unique } from "drizzle-orm/mysql-core"
import { sql } from "drizzle-orm"
export const entity = mysqlTable("Entity", {
id: int("id").autoincrement().notNull(),
name: varchar("name", { length: 191 }).notNull(),
},
(table) => {
return {
entityId: primaryKey({ columns: [table.id], name: "Entity_id"}),
}
});
export const entityTag = mysqlTable("EntityTag", {
id: int("id").autoincrement().notNull(),
name: varchar("name", { length: 191 }).notNull(),
},
(table) => {
return {
entityTagId: primaryKey({ columns: [table.id], name: "EntityTag_id"}),
}
});
export const entityToEntityTag = mysqlTable("_EntityToEntityTag", {
a: int("A").notNull().references(() => entity.id, { onDelete: "cascade", onUpdate: "cascade" } ),
b: int("B").notNull().references(() => entityTag.id, { onDelete: "cascade", onUpdate: "cascade" } ),
},
(table) => {
return {
bIdx: index().on(table.b),
entityToEntityTagAbUnique: unique("_EntityToEntityTag_AB_unique").on(table.a, table.b),
}
});
No index names
Also not working for us in 0.24.1
Seeing this as well, 0.24.2
What version of
drizzle-orm
are you using?0.31.2
What version of
drizzle-kit
are you using?0.22.6
Describe the Bug
I ran introspect command but It doesn't get index names
Expected behavior
I expected to get the index name
_TableToOtherTable_B_index
Environment & setup
mysql v8.0.32