Skip to content

back to roots#82

Merged
vigo merged 2 commits intomainfrom
back-to-roots
Apr 23, 2026
Merged

back to roots#82
vigo merged 2 commits intomainfrom
back-to-roots

Conversation

@vigo
Copy link
Copy Markdown
Contributor

@vigo vigo commented Apr 23, 2026

  • remove old migrations
  • fix migrations

Copilot AI review requested due to automatic review settings April 23, 2026 07:07
@vigo vigo merged commit 6850753 into main Apr 23, 2026
2 checks passed
@vigo vigo deleted the back-to-roots branch April 23, 2026 07:09
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b6f1b4fdd2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

--
-- Create "github_target_type" enum
--
CREATE TYPE "cauldron"."github_target_type" AS ENUM (
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore original migration version numbering

Reusing version IDs by renaming older migrations into 000001/000002/000003 breaks forward upgrades for databases that already recorded those versions in schema_migrations: for example, an instance previously at old version 2 will skip the new GitHub table migration, and one at old version 3 will be considered up-to-date without running the new GitLab migration. Since runMigration only executes m.Up() (cmd/migrator/main.go), these nodes can reach runtime relation does not exist failures when consumers insert. Keep existing version numbers immutable and add new migrations with higher versions instead of reassigning prior numbers.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR resets and simplifies the database migration set by removing a large set of previously-added migrations and folding core schema setup (schema + UUID extension) and base tables (GitHub/GitLab) into the first few migrations.

Changes:

  • Removed migrations 000004000018 (tables/settings/index migrations), leaving only a minimal baseline migration set.
  • Consolidated schema + uuid-ossp extension creation into 000001_schema_extension.*.
  • Adjusted base table migrations to include essential indexes (e.g., created_at) and aligned down migrations accordingly.

Reviewed changes

Copilot reviewed 38 out of 38 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
migrations/000018_add_github_push_repo_ref_created.up.sql Removed old index migration (no longer part of migration chain).
migrations/000018_add_github_push_repo_ref_created.down.sql Removed old index rollback migration.
migrations/000017_gitlab_org_settings.up.sql Removed old GitLab org settings table migration.
migrations/000017_gitlab_org_settings.down.sql Removed old GitLab org settings rollback migration.
migrations/000016_add_conclusion_and_delivery_indexes.up.sql Removed old GitHub index migration.
migrations/000016_add_conclusion_and_delivery_indexes.down.sql Removed old GitHub index rollback migration.
migrations/000015_add_meta_data_field_to_app_user.up.sql Removed old app_user meta_data migration.
migrations/000015_add_meta_data_field_to_app_user.down.sql Removed old app_user meta_data rollback migration.
migrations/000014_add_team_filter_indexes.up.sql Removed old GitHub filtering index migration.
migrations/000014_add_team_filter_indexes.down.sql Removed old GitHub filtering index rollback migration.
migrations/000013_add_meta_data_to_github_org_settings.up.sql Removed old GitHub org settings meta_data migration.
migrations/000013_add_meta_data_to_github_org_settings.down.sql Removed old GitHub org settings meta_data rollback migration.
migrations/000012_add_tenant_config.up.sql Removed old tenant_config table migration.
migrations/000012_add_tenant_config.down.sql Removed old tenant_config rollback migration.
migrations/000011_github_org_settings.up.sql Removed old GitHub org settings table migration.
migrations/000011_github_org_settings.down.sql Removed old GitHub org settings rollback migration.
migrations/000010_add_indexes_for_gitlab.up.sql Removed old GitLab index-only migration.
migrations/000010_add_indexes_for_gitlab.down.sql Removed old GitLab index-only rollback migration.
migrations/000009_add_indexes_for_github.up.sql Removed old GitHub index-only migration (indexes moved/removed).
migrations/000009_add_indexes_for_github.down.sql Removed old GitHub index-only rollback migration.
migrations/000008_gitlab_user.up.sql Removed old gitlab_user table migration.
migrations/000008_gitlab_user.down.sql Removed old gitlab_user rollback migration.
migrations/000007_gitlab.up.sql Removed old gitlab table migration (reintroduced as new baseline 000003).
migrations/000006_add_github_payload_indexes.up.sql Removed old GitHub payload index migration.
migrations/000006_add_github_payload_indexes.down.sql Removed old GitHub payload index rollback migration.
migrations/000005_github_user.up.sql Removed old github_user table migration.
migrations/000005_github_user.down.sql Removed old github_user rollback migration.
migrations/000004_app_user.up.sql Removed old app_user + enum migration.
migrations/000004_app_user.down.sql Removed old app_user + enum rollback migration.
migrations/000003_gitlab.up.sql Added new baseline GitLab table + indexes migration.
migrations/000003_gitlab.down.sql Updated rollback to also drop the newly-added idx_gitlab_created_at.
migrations/000002_github.up.sql Updated GitHub migration to include idx_github_created_at and use IF NOT EXISTS for indexes.
migrations/000002_github.down.sql Updated rollback to drop idx_github_created_at.
migrations/000002_enable_uuid_extension.up.sql Removed (extension creation moved into 000001_schema_extension.up.sql).
migrations/000001_schema_extension.up.sql Added consolidated schema + uuid-ossp extension creation.
migrations/000001_schema_extension.down.sql Updated rollback to drop extension and schema.
migrations/000001_create_schema.up.sql Removed (schema creation moved into 000001_schema_extension.up.sql).
migrations/000001_create_schema.down.sql Removed (schema drop moved into 000001_schema_extension.down.sql).
Comments suppressed due to low confidence (1)

migrations/000001_schema_extension.down.sql:2

  • CREATE ... IF NOT EXISTS in the up migration can silently succeed on a DB where the schema/extension already existed, but the down migration will still drop them. If this is meant to be reversible and safe on pre-provisioned databases, consider removing IF NOT EXISTS here (fail fast) or adjusting the down strategy/documentation so it doesn’t remove pre-existing shared objects.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +2
CREATE SCHEMA IF NOT EXISTS "cauldron";
CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; No newline at end of file
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR resets the migration history (only 000001–000003 remain). Any existing DB that previously ran the old migrations will have a schema_migrations version that no longer exists in the migrations source, which can break golang-migrate operations (including up/goto/down). Please provide an explicit upgrade path (e.g., keep old versions as no-op stubs, add a baseline migration at the prior latest version, or document that a DB reset/migrate force is required).

Copilot uses AI. Check for mistakes.
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.

2 participants