Skip to content

Feature Request: Verification Step #125

@langsharpe

Description

@langsharpe

Has anyone else had a need to for a verification step. An assurance that the migration has completed successfully. e.g.

Lhm.change_table :my_table do |table|
  table.ddl "ALTER TABLE `#{table.name}` DEFAULT CHARACTER SET utf8mb4, DEFAULT COLLATE utf8mb4_unicode_ci"
  verification do |table|
    result = table.query "SELECT count(*) FROM {#table.name) as new_table JOIN #{table.name} as old_table USING (id) WHERE new_table.name != old_table.name"
    result.first[0] == 0
  end
end

The verification block would be executed after the Chunker and before the Switcher. If it evaluated to false the change would be rolled back.

Does anyone else have a need for this and what strategies do you currently use? Does a feature like this fit into this gem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions