-
Notifications
You must be signed in to change notification settings - Fork 901
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
Updating versions when schema changes #402
Comments
A conversation has lead me to some... thoughts... I have been using paper_trail strictly to document the changes to the meaningful domain data. I have not considered using it to also document the history of changes to my Logical Data Model. It seems that these are two concerns, the semantic business data (which I've been trying my best to use paper_trail for only) and the Logical Data Model underlying that. Not sure what the least insane way to think about this is. Should old versions reflect the nature of the data structure? To illustrate
So my Person models can't access family_name/surname history post 2000-01-01 or I have to write something to deal with that programmatically. Which I really, really do not want to do. ... I hope some one else reads this stuff and throws in their 0.02 |
Version In terms of renaming of tables and attributes, there isn't something built around updating versions to contain updated attribute names. My first thought with regards to how to accomplish this is probably building a rake task / script to take care of that, which it looks like you've already started on. In terms of your idea about whether old versions should reflect the nature of the data structure at the time, that is up to you I suppose. If you want my opinion, I guess without too much consideration I think that it probably makes sense to update attribute names in old versions when a small change like the renaming of an attribute name occurs (i.e. In other words, perhaps instead of renaming your table from |
I'll get started and show you the source when it starts to resemble something useful. |
Closing after three years of inactivity. |
yeah... i forgot about this, sorry |
No worries! I enjoyed reading your discussion with Ben. It sounds like a difficult problem to solve generally, but interesting to think about. |
Sorry to comment on an old issue, but I just had this one come up. On it's own, this isn't a showstopper. But, if I combine this scenario with the rails_admin integration, the whole rails_admin interface 500s if I ever change a model name because PaperTrail is referencing an uninitialized constant. Maybe it doesn't require a code change, but some mention in a "Gotchas" section of the README? |
When table names or attributes change we need to have a way to maintain coherence with version records. Not just item_type, but also the serialised attributes in the object attribute. Since it's a string it's non trivial and requires special SQL in many cases.
I've ended up doing it this way because I didn't want to write that SQL, we aren't sure what db we'll end up with in prod. It's far from ideal, this sort of code ought to be in a tool with paper_trail, specifically to facilitate migrations.
Is this in the works, or does someone need to get started on it?
The text was updated successfully, but these errors were encountered: