Migrations
Last updated
Last updated
Shipclojure uses to handle migrations. For ease of creating migrations, there is the
By default, ShipClojure stores migrations in a table in the main DB
See
db.sql/migrations
key in
Let's say you need to create a new image table in the DB to store user images.
Visit
In the last comment, you'll see imported the migration-config
from user
Write in the same comment
Evaluate this in the REPL
Expect to see 2 new files {current-date}-add-images-table.{up,down}.sql
in resources/db/migrations
Add the correct up & down configurations, and reset the integrant system. The migrations will be applied automatically
Important: If you want to include multiple statements in the same migration file there is a special notation (
--;;
) you need to use, otherwise you'll get an errorToo many update results were returned
:
To roll back migrations, use user/rollback-latest-migration