Skip to content

DataProviderMigrate: verifier detects FK onDelete drift but migrator never repairs it (perpetual 'integrity check failed') #67

@MelbourneDeveloper

Description

@MelbourneDeveloper

Version: dataprovidermigrate 0.9.12-beta (dotnet tool)

Repro (live prod DB, TradiSite project):
Schema YAML declares e.g.:

foreignKeys:
  - columns: [org_id]
    referencedTable: orgs
    onDelete: Cascade

The live DB has the same FK but with ON DELETE NO ACTION (created by an older schema rev).

Actual:

Migration completed successfully
SCHEMA INTEGRITY CHECK FAILED
public.sites: foreign key FK_public.sites_org_id on delete expected Cascade but found NoAction
public.domain_configs: foreign key FK_public.domain_configs_site_id on delete expected Cascade but found NoAction
public.usage_tracking: foreign key FK_public.usage_tracking_site_id on delete expected Cascade but found NoAction

Exit code 1. Every subsequent run does exactly the same — the migrator plans zero operations for the mismatched FKs, so the tool can never converge the DB to the declared schema. The verifier knows precisely what is wrong; the planner ignores it.

Expected: the migrator should emit drop+recreate (or ALTER) of the FK with the declared referential action, so a second run passes. Detect-but-never-repair makes migrate permanently red on any DB that predates an onDelete change.

Workaround used: manual ALTER TABLE ... DROP CONSTRAINT / ADD CONSTRAINT ... ON DELETE CASCADE via psql, after which the integrity check passes.

Found while operating TradiSite prod (MelbourneDeveloper/TradiSite, spec [DB-MIGRATE-CLI-ONLY]).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions