Adding 'Executing the migrations' subsection into README.md. Adding log messages on deploy.yml.
All checks were successful
Deploy Greenlight API / deploy (push) Successful in 55s

This commit is contained in:
Maxime Delporte
2025-10-31 12:05:53 +01:00
parent 80800b214c
commit 10ea699625
2 changed files with 26 additions and 1 deletions

View File

@@ -59,6 +59,23 @@ In this command:
- The **-dir** flag indicates that we want to store the migration files in the **./migrations** directory (which will be created automatically if it doesn't already exist).
- The name **create_movies_table** is a descriptive label that we give the migration files to signify their contents.
### Executing the migrations
```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:
```sql
ALTER DATABASE greenlight OWNER TO greelight;
```
If that still doesn't work, try explicitly granting the **CREATE** privileges to the **greenlight** user:
```sql
GRANT CREATE ON DATABASE greenlight TO greelight;
```
## Additional Information
### How different Go Types are encoded