Running drizzle-kit introspect:mysql gives scheme output that is not valid, and forces manual edits in the Typescript schema:
Incorrectly generated index names (none, instead of real names)
Incorrect value on non-null values
If you run the drizzle-kit generate:mysql again - you'll get a migration
sample table creation:
create table test_table
(
id int auto_increment
primary key,
some_key int not null,
some_value int null,
timestamp timestamp default current_timestamp() not null
);
create index test_table_some_key_index
on test_table (some_key);
create index test_table_some_value_index
on test_table (some_value);
Argument of type 'string' is not assignable to parameter of type 'number | SQL '
Issue with someKeyIdx: index().on(table.someKey),
Expected 1 arguments, but got 0.
Running drizzle-kit generate:mysql will create a migration, when the values already correct:
ALTER TABLE `test_table` MODIFY COLUMN `id` int AUTO_INCREMENT NOT NULL;--> statement-breakpoint
ALTER TABLE `test_table` MODIFY COLUMN `some_key` int NOT NULL;--> statement-breakpoint
ALTER TABLE `test_table` MODIFY COLUMN `some_value` int;
What version of
drizzle-orm
are you using?0.28.6
What version of
drizzle-kit
are you using?0.19.13
Describe the Bug
Running
drizzle-kit introspect:mysql
gives scheme output that is not valid, and forces manual edits in the Typescript schema:drizzle-kit generate:mysql
again - you'll get a migrationsample table creation:
running
drizzle-kit introspect:mysql
Issue with
.default('NULL')
:Issue with
someKeyIdx: index().on(table.someKey),
Running
drizzle-kit generate:mysql
will create a migration, when the values already correct:Expected behavior
Correct typescript definition of generated table:
Idempotent migration. It shouldn't create a new migration on a newly introspected table
Environment & setup
Mariadb: 10.10.2-MariaDB-1:10.10.2+maria~ubu2204
npm: "mysql2": "^3.6.1" "drizzle-orm": "^0.28.6" "drizzle-kit": "^0.19.13"
node: v16.20.2