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

Create migrations for data comparison step #33677

Merged
merged 2 commits into from Mar 18, 2020

Conversation

hacodeorg
Copy link
Contributor

@hacodeorg hacodeorg commented Mar 17, 2020

Create 2 tables:

  • contact_rollups_final: The final complete data of all contacts in our system. It has the same content and same structure as contact_rollups_processed table from the previous execution of the pipeline.
  • contact_rollups_comparisons: Contains the comparison of the current contact_rollups_processed and the existing contact_rollups_final (which is an older version of contact_rollups_processed).

Links

@hacodeorg hacodeorg requested a review from a team March 17, 2020 05:05
@hacodeorg hacodeorg marked this pull request as ready for review March 17, 2020 05:05
class CreateContactRollupsFinal < ActiveRecord::Migration[5.0]
def change
create_table :contact_rollups_final do |t|
t.string :email, null: false, index: {unique: true}
Copy link
Contributor

Choose a reason for hiding this comment

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

I had this question on my migration as well -- if we have a unique index on email, will that cause problems if we add a soft delete option? I think here we'd actually only want to hard delete (in the case of account deletion), but just wondering.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We likely just need hard delete since we're rebuilding everything in each run. However, if we want to use soft delete, we can change the indexes following this instruction https://github.com/rubysherpas/paranoia#about-indexes.

@hacodeorg hacodeorg merged commit 8c512c3 into staging Mar 18, 2020
@fisher-alice fisher-alice deleted the ha/cr-compare-data-migration branch July 13, 2022 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants