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

Upgrade to 1.1.0 with existing data not possible #11

Closed
doits opened this issue Jan 2, 2019 · 4 comments
Closed

Upgrade to 1.1.0 with existing data not possible #11

doits opened this issue Jan 2, 2019 · 4 comments

Comments

@doits
Copy link

doits commented Jan 2, 2019

With the latest 1.1.0 update, the :foreign_type column is introduced. It has null: false, which means it cannot be added to existing data (since there will be null values unless they are explicitly computed). I tried a manual migration to add the column:

-- add_column(:version_associations, :foreign_type, :string, {:null=>false})
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::NotNullViolation: ERROR:  column "foreign_type" contains null values

Is it possible to update to the latest version with existing data?

@benhutton
Copy link

We're running into this too!

@ekzobrain
Copy link

Same problem

@westonganger
Copy link
Owner

Sorry guys. I've just fixed this on master. This update ensures compatibility with existing data containing existing null values. Can you test it out for me and see if its all working well.

Also this latest commit includes a generator for the migration for the new column using rails g paper_trail_association_tracking:add_foreign_type_to_version_associations. These upgrade steps are now documented in the changelog too.

@westonganger
Copy link
Owner

v1.1.1 is now released which fixes this.

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

No branches or pull requests

4 participants