Get `CREATE TABLE ...` SQL from a schema

Is there a way to get the SQL to create a table based on the table's schema ? I am doing some tests with Drizzle-ORM, and I don't want to setup Drizzle-Kit and all the migrations stuff just for that. Given a table variable defined with const table = sqliteTable('table_name', schema);, is there a way to get the SQL to create the table in the db ? Something like db.run(table.getCreateQuery()). Thanks !
2 Replies
Mario564
Mario5643mo ago
There's currently no way of doing exactly what you need here. If the table is present in your dev and prod schema, you could setup a script to reset the DB and then apply migrations, then truncate the table before every test case.
Le Michel
Le MichelOP3mo ago
Ok, thanks for your reply

Did you find this page helpful?