Skip to content

Latest commit

 

History

History
14 lines (11 loc) · 1020 Bytes

README.md

File metadata and controls

14 lines (11 loc) · 1020 Bytes

STEELMAN

DB

STEELMAN database is managed with migrate. To create an update in the database like an addition, removal or edition of a table or a column in a table you must create a migration file running the following command:

$migrate create -ext sql -dir db/migrations -seq <migration>

After running the command, two files in db/migrations will be created, the up file with the extension up.sql and the down file with the extension down.sql. In the up file you must write the sql code to udpate the database and in the down file you must write the sql code to rollback the intended update.

Docker-compose will take care of the rest, you just have to run the migrate container to update the database.

Note: <migration> must have a representative name like create_user_table or remove_id_column_user_table

For more info about how to use migrate: https://github.com/golang-migrate/migrate/blob/master/database/postgres/TUTORIAL.md