Skip to content

πŸ”„ [MEDIUM] Database Architecture is Unclear β€” SQLite vs Postgres Migration MismatchΒ #999

Description

@ayomideadeniran

Description

The project has inconsistent database architecture decisions between SQLite and Postgres.

Evidence

  1. Backend: backend/src/database/connection.js opens SQLite with WAL mode
  2. Knex config: backend/knexfile.js configures SQLite, expects migrations in src/database/migrations/
  3. Migrations: backend/migrations/ directory contains Postgres SQL files (V001__create_users_table.up.sql, V002__add_rate_limiting.up.sql, etc.)
  4. Indexer: indexer/migrations/postgres/ has Postgres-specific migration SQL
  5. Root Rust source: src/postgres.rs and src/sqlite.rs suggest dual-write support

Impact

  • Unclear which database system is the "source of truth"
  • Contributors might add SQLite-specific or Postgres-specific code that breaks the other
  • The schema.sql file has extensive DDL that is never run through knex migrations
  • Postgres migration files exist but knex is configured for SQLite

Required Fix

  1. Decide on a primary database (recommended: keep SQLite for simplicity, add Postgres as optional)
  2. Document the database strategy in CONTRIBUTING.md
  3. Clean up unused migration files
  4. Ensure knex migrations match the actual schema in schema.sql

Reference

Identified during full codebase audit of soroban-playground.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend related issuesdatabaseDatabase related issuesenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions