Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Verification Step #125

Open
langsharpe opened this issue Aug 24, 2015 · 2 comments
Open

Feature Request: Verification Step #125

langsharpe opened this issue Aug 24, 2015 · 2 comments

Comments

@langsharpe
Copy link

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?

@arthurnn
Copy link
Contributor

wondering if we were doing that check manually or not. @camilo @sroysen do you know?

@camilo
Copy link
Contributor

camilo commented Sep 23, 2015

no, but the metadata lock should prevent any rows from being inserted/changed ( within the kown potential problems the replace/triggers have) I don't think is needed cc @sroysen

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

No branches or pull requests

3 participants