Skip to content

Commit 4dcbd4c

Browse files
committed
use combined step in README
1 parent 86fb998 commit 4dcbd4c

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

packages/database/README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,19 @@ All CLI commands below should be run in this directory (`packages/database`.)
88
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.)
99
5. Install [sqruff](https://github.com/quarylabs/sqruff)
1010
2. Usage:
11-
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.
1212
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.
1414
3. Development: We follow the supabase [Declarative Database Schema](https://supabase.com/docs/guides/local-development/declarative-database-schemas) process.
1515
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`
2526
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

Comments
 (0)