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
Copy file name to clipboardExpand all lines: packages/database/README.md
+12-11Lines changed: 12 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,18 +8,19 @@ All CLI commands below should be run in this directory (`packages/database`.)
8
8
4.`supabase link`. It will ask you for a project name, use `discourse-graphs`. (Production for now.) It will also ask you for the database password (See 1password.)
1. Use `supabase start` before you use your local database. URLs will be given for your local supabase database, api endpoint, etc.
11
+
1. Use `turbo dev`, (alias for `supabase start`) before you use your local database. URLs will be given for your local supabase database, api endpoint, etc.
12
12
2. You may need to `supabase db pull` if changes are deployed while you work.
13
-
3. End you work session with `supabase end` to free docker resources.
13
+
3. End you work session with `npm run stop` (alias for `supabase end`) to free docker resources.
14
14
3. Development: We follow the supabase [Declarative Database Schema](https://supabase.com/docs/guides/local-development/declarative-database-schemas) process.
15
15
1. Assuming you're working on a feature branch.
16
-
2.`supabase stop` if it's running.
17
-
3. Make changes to the schema, by editing files in `project/database/supabase/schemas`
18
-
4. If you created a new schema file, make sure to add it to `[db.migrations] schema_paths` in `packages/database/supabase/config.toml`. Schema files are applied in that order, you may need to be strategic in placing your file.
19
-
5. Check your logic with `sqruff lint supabase/schemas`, and eventually `sqruff fix supabase/schemas`
20
-
6. Regenerate the types file with `supabase gen types typescript --local > types.gen.ts`
21
-
7.`supabase db diff -f some_meaningful_migration_name`
22
-
8. If applying the new schema fails, repeat steps 2 to 7
23
-
9. If all goes well, there should be a new file named `supbase/migration/2..._some_meaningful_migration_name.sql` which you should `git add`.
24
-
10. You can start using your changes `supabase start`
16
+
2. Make changes to the schema, by editing files in `project/database/supabase/schemas`
17
+
3. If you created a new schema file, make sure to add it to `[db.migrations] schema_paths` in `packages/database/supabase/config.toml`. Schema files are applied in that order, you may need to be strategic in placing your file.
18
+
4.`turbo build`, which will do the following:
19
+
1. Check your logic with `sqruff lint supabase/schemas`, and eventually `sqruff fix supabase/schemas`
20
+
2. Regenerate the types file with `supabase gen types typescript --local > types.gen.ts`
21
+
3. See if there would be a migration to apply with `supabase db diff`
22
+
5. If applying the new schema fails, repeat step 4
23
+
6. If you are satisfied with the migration, create a migration file with `npm run dbdiff:save some_meaningful_migration_name`
24
+
1. If all goes well, there should be a new file named `supbase/migration/2..._some_meaningful_migration_name.sql` which you should `git add`.
25
+
10. You can start using your changes again `turbo dev`
25
26
11. When your PR gets merged to main, deploy your changes to production with `supabase db push`. (URGENT TODO: make that a CI/CD step.)
0 commit comments