Refactor code structure for improved readability and maintainability

This commit is contained in:
Poyraz
2026-06-16 10:04:41 +03:00
parent 72a0b38f3e
commit f352918950
12 changed files with 1706 additions and 7 deletions
+19 -3
View File
@@ -2,6 +2,22 @@
This directory stores SQL files for the project's Supabase/PostgreSQL database.
## One-Shot Setup
For a fresh Supabase project, use:
```text
supabase/setup.sql
```
You can paste the full file into Supabase SQL Editor and run it once, or run it from the repository root with `psql`:
```bash
psql "postgresql://postgres:[PASSWORD]@[HOST]:5432/postgres" -v ON_ERROR_STOP=1 -f supabase/setup.sql
```
The setup file is generated by concatenating `schema.sql` and migrations `0002` through `0011` in the canonical order. Demo seed data is intentionally not included.
## Current Baseline
- `schema.sql` is the first registered database SQL file.
@@ -42,10 +58,10 @@ Do not overwrite already executed SQL without also creating a new ordered migrat
## Apply Migrations
From the repository root:
For a new project, prefer the one-shot setup file:
```bash
DATABASE_URL='postgresql://postgres:password@host:5432/postgres' bash ./scripts/apply-migrations.sh
psql "postgresql://postgres:[PASSWORD]@[HOST]:5432/postgres" -v ON_ERROR_STOP=1 -f supabase/setup.sql
```
The script applies all required schema files in canonical order. It requires either local `psql` or Docker. If `psql` is not installed, it runs `psql` through the `postgres:16-alpine` Docker image.
The ordered migration files remain as the source history for future schema changes.