Database Migrations with Goose & Neon
MTVL uses Goose for versioned, declarative SQL database schema migrations.Migration Architecture
Migrations reside inmigrations/postgres/:
20260804191235_users.sql: Createsuserstable and authentication indexes.20260804191237_movies.sql: Createsmoviesanduser_movie_liststables.20260804191238_tv_shows.sql: Createstv_showsanduser_tv_show_liststables.20260804191240_books.sql: Createsbooksanduser_book_liststables.20260912020906_api_tokens.sql: Creates personal developerapi_tokenstable.
Running Migrations Automatically on Startup
MTVL embeds migrations into the compiled Go binary using//go:embed migrations/*/*.sql.
When the backend container starts, it automatically checks the goose_db_version table in Neon and executes any unapplied SQL migration files in sequence inside a database transaction.