diff --git a/README.md b/README.md index e9e359b..73b1a44 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,8 @@ In this command: ```bash migrate -path=./migrations -database=$GREENLIGHT_DB_DSN up ``` +--- + Note: You may get the error: **error: pq: permission denied for schema public...** when running this command. It's because Postgres might revoke the **CREATE** permission from all users except a database ownser. To get around this, set the database owner to the **greenlight** user: @@ -76,6 +78,22 @@ If that still doesn't work, try explicitly granting the **CREATE** privileges to GRANT CREATE ON DATABASE greenlight TO greelight; ``` +--- + +The **schema_migrations** table is automatically generated by the **migrate** tool and used to keep track of which migrations have been applied. + +``` +greenlight => SELECT * FROM schema_migrations; + +version | dirty +----------------- + 2 | f +``` + +The **version** column here indicates that our migration files up (and including) number **2** in the sequence have been executed against the database. The value of **dirty** column is **false**, which indicates that the migration files were cleanly executed _without any errors_ and the SQL statements they contain were successfully applied in _full_. + +You can run the **\d** meta command on the **movies** table to see the structure of the table and confirm the **CHECK** constraints were created correctly. + ## Additional Information ### How different Go Types are encoded