Skip to content

MOS-12: Add goose migrations and initial PostgreSQL schema - #16

Merged
timoruohomaki merged 1 commit into
masterfrom
feat/MOS-12-goose-schema
Nov 8, 2026
Merged

timoruohomaki merged 1 commit into
masterfrom
feat/MOS-12-goose-schema

Conversation

@timoruohomaki

Copy link
Copy Markdown
Contributor

internal/store/postgres embeds SQL migrations and applies them with goose (Migrate, MigrateDownTo, Version). Tables and the goose version table live in the openmos schema; a Postgres session lock keeps concurrent deploys from migrating at once, and the schema is only created if missing, so openmos_migrate needs no CREATE on the database.

00001_init.sql creates running_orders, stories, items and mos_objects: composite keys, deferrable per-parent position constraints, sample-based durations with an exact numeric time base, timestamptz, cascade deletes and MOS limits as CHECK constraints. No GRANTs (default privileges).

Tests cover up/down/up, keys, deferred swaps, cascades and limits against OPENMOS_TEST_DATABASE_URL (skipped locally without it, required in CI). CI gains a postgres:17 service container.

goose v3.29 requires Go 1.26, so go.mod moves from 1.25 (now out of support) to 1.26.

internal/store/postgres embeds SQL migrations and applies them with goose
(Migrate, MigrateDownTo, Version). Tables and the goose version table
live in the openmos schema; a Postgres session lock keeps concurrent
deploys from migrating at once, and the schema is only created if
missing, so openmos_migrate needs no CREATE on the database.

00001_init.sql creates running_orders, stories, items and mos_objects:
composite keys, deferrable per-parent position constraints, sample-based
durations with an exact numeric time base, timestamptz, cascade deletes
and MOS limits as CHECK constraints. No GRANTs (default privileges).

Tests cover up/down/up, keys, deferred swaps, cascades and limits
against OPENMOS_TEST_DATABASE_URL (skipped locally without it, required
in CI). CI gains a postgres:17 service container.

goose v3.29 requires Go 1.26, so go.mod moves from 1.25 (now out of
support) to 1.26.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@timoruohomaki
timoruohomaki merged commit 37c758c into master Nov 8, 2026
3 checks passed
@timoruohomaki
timoruohomaki deleted the feat/MOS-12-goose-schema branch November 8, 2026 19:19
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