Replies: 4 comments 5 replies
-
Did you already check Drizzle's migrations table in the DB? You could query that table. |
Beta Was this translation helpful? Give feedback.
-
@0xOlias did you figure out a solution to this? |
Beta Was this translation helpful? Give feedback.
-
It would be nice to be able to use the Drizzle API to create and delete tables programmatically. Our use case is for testing. For example, we have many different test files that need to operate on a table, and these test files run concurrently. It would be nice for us to be able to create a table per test file (e.g. test_file_1_widgets, test_file_2_widgets). Then, we can easily add data per test file and delete the data in the tables per test file without conflicts between the two test files. I think we can potentially use raw sql to create and delete files in the setup and teardown of tests, but because we define the tables using Drizzle, it would be much more convenient to be able to simply use the API to do this. We also can run out tests serially, but this impacts our overall test performance. If anyone has any better solution, please let me know. Thanks. |
Beta Was this translation helpful? Give feedback.
-
i'm interested in using drizzle in a cli tool, and would be nice in that context to intialize sqlite databases with a schema, and without needing to generate migration files |
Beta Was this translation helpful? Give feedback.
-
I have a use case where it would be really nice if a table object had a method similar to
query.toSQL()
that returned (or executed) the SQL query required to create that table and any indices.From SQLite example:
This API would return or execute the query:
Would also appreciate any ideas for workarounds. My use case involves programmatically creating a temporary table in a SQLite database (cannot use a CLI for migrations like
drizzle-kit
).In an ideal world, this API would also somehow support constraints/statements that reference multiple tables as demonstrated here.
Beta Was this translation helpful? Give feedback.
All reactions