You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For production environments the `refactor_platform` schema is **not** created automatically by SeaORM migrations.
41
+
Create it once in your production database before running any migrations:
42
+
43
+
```sql
44
+
CREATESCHEMAIF NOT EXISTS refactor_platform;
45
+
```
46
+
47
+
After the schema exists, run the normal migration commands (all examples below continue to use `-s refactor_platform`).
48
+
49
+
### Schema Privileges (Production)
50
+
51
+
After the schema exists, ensure the `refactor` role (used in the `DATABASE_URL`) has the proper rights; otherwise the migrator will error with `permission denied for table seaql_migrations`.
52
+
53
+
```sql
54
+
-- Allow the role to create and use objects in the schema
55
+
GRANT USAGE, CREATE ON SCHEMA refactor_platform TO refactor;
56
+
57
+
-- Transfer ownership of the SeaORM migrations tracking table (required if it was created by another role such as `doadmin`)
58
+
ALTERTABLErefactor_platform.seaql_migrations OWNER TO refactor;
59
+
60
+
-- Grant DML privileges on all existing tables
61
+
GRANTSELECT, INSERT, UPDATE, DELETEON ALL TABLES IN SCHEMA refactor_platform TO refactor;
62
+
63
+
-- Ensure future tables inherit these privileges
64
+
ALTER DEFAULT PRIVILEGES IN SCHEMA refactor_platform
65
+
GRANTSELECT, INSERT, UPDATE, DELETEON TABLES TO refactor;
66
+
67
+
-- Ensure the application role searches the refactor_platform schema first
68
+
ALTER ROLE refactor SET search_path = refactor_platform, public;
0 commit comments