Updating 'Executing the migrations' sub-section.
All checks were successful
Deploy Greenlight API / deploy (push) Successful in 1m16s

This commit is contained in:
Maxime Delporte
2025-11-03 17:39:46 +01:00
parent a5025cd98e
commit 4b42c5edfc

View File

@@ -64,6 +64,8 @@ In this command:
```bash ```bash
migrate -path=./migrations -database=$GREENLIGHT_DB_DSN up 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. 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: 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; 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 ## Additional Information
### How different Go Types are encoded ### How different Go Types are encoded