-
Is there any way to generate a SQL schema file from the existing versioned migrations? We would like to be able to create a test db server quickly with an empty schema, and the easiest way would be generate the current SQL schema and pass it to PostgreSQL server during start. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @plutino Thanks for reaching out. It's possible to use "schema inspect" on a migration dir. by using SQL formatting you can get the "sum" schema: atlas schema inspect -u "file://path/to/dir" --dev-url docker://postgres/15 --format "{{ sql . }}" Notice that if you use "schema apply" you can directly apply this schema to your target db. |
Beta Was this translation helpful? Give feedback.
Hey @plutino
Thanks for reaching out. It's possible to use "schema inspect" on a migration dir. by using SQL formatting you can get the "sum" schema:
atlas schema inspect -u "file://path/to/dir" --dev-url docker://postgres/15 --format "{{ sql . }}"
Notice that if you use "schema apply" you can directly apply this schema to your target db.