Skip to content

feat(db): #71: add versioned SQL migration module and clean up repository DDL - #75

Merged
imdeepmind merged 1 commit into
developfrom
#71
Aug 30, 2026
Merged

feat(db): #71: add versioned SQL migration module and clean up repository DDL#75
imdeepmind merged 1 commit into
developfrom
#71

Conversation

@imdeepmind

Copy link
Copy Markdown
Owner

Summary

Replaces ad-hoc per-repository table DDL (initializeTable / InitializeSchema) with a dedicated, versioned SQL migration module under internal/migrations/.

Changes Included

  1. Dedicated Migration Package (internal/migrations/):

    • SQLite DDL in internal/migrations/sqlite/001_initial_schema.sql
    • PostgreSQL DDL in internal/migrations/postgresql/001_initial_schema.sql
    • Transactional, idempotent migration runner in internal/migrations/runner.go that maintains the schema_migrations table.
  2. Connection Hook:

    • Added Connection.SetAndMigrate(ctx, client, runner) in internal/clients/db/client.go so migrations run whenever a database connection is opened at login or registration.
  3. Repository DDL Cleanup:

    • Removed all table creation SQL statements, initMu, and initClient fields from auth, queue, upload, and home repositories.
  4. Wiring:

    • Injected migration runner in main.go and auth.Service.

@imdeepmind
imdeepmind merged commit aba3161 into develop Aug 30, 2026
6 checks passed
@imdeepmind
imdeepmind deleted the #71 branch August 30, 2026 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant