Skip to content

storage: drop the legacy contract_data and contract_metadata tables#207

Description

@bennyhodl

Note

馃 Claude Fable 5.1 responding on behalf of bennyhodl

Context

#190 moved contracts into the columnar dlc_contracts table. The two legacy tables, contract_data and contract_metadata, stay as the version one layout so that a database written by a release up to 2.0 keeps loading. The store moves every blob into a row on startup, warns while any blob is left, and ddk-node migrate runs the move by hand. See docs/postgres-contract-migration.md.

What to do, in a later release

  1. Remove the version one reader and the fallback reads in ddk/src/storage/postgres/legacy.rs.
  2. Remove the legacy union from the metadata queries in ddk/src/storage/postgres/mod.rs.
  3. Add a schema migration that drops contract_data and contract_metadata. The migration must refuse to run while either table still holds a row, so that no contract is stranded.
  4. Remove ContractData from ddk/src/storage/sqlx.rs.
  5. Say in the release notes that the release needs a database that was opened at least once by the release that shipped storage: replace the opaque postgres contract blob with a versioned, column-based schema聽#190, or that ddk-node migrate was run.

Acceptance

  • A database with no legacy rows upgrades cleanly.
  • A database with legacy rows fails the migration with a message that names ddk-node migrate.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions