-
Notifications
You must be signed in to change notification settings - Fork 10
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
Change byte_size
in ActiveStorage::Blob
#2621
Comments
Strong Migrations
Strong Migrations will catch unsafe migrations in development ✓ Detects potentially dangerous operations
This is what they say about changing the type of a column
|
First passMy initial response to this issue was to just change the column type.
The reviewer of my proposed change kindly pointed out that
The management team want to get this out the door and can tolerate small outages so this version of the change is what we're going to use. |
Is there a better place for this than in an issue comment? Zero downtimeFrom Zero Downtime Migrations in Rails
Let's work through an exampleThis is what
Create a new column
Write to both columns
Could also do this by adding a trigger in SQL Back-fill data from the old column to the new columnThere seems to be a few ways that people have used to back-fill data
In the migration
In the migration with SQL
In the migration but with a gemChange data in migrations like a boss cautions
Their solution is migration_data which allows you to do data migrations in Another possibly better solution from a gemdata_migrate adds rake tasks to migrate data alongside schema changes. Data migrations are stored in db/data. They act like schema migrations, except they should be reserved for data migrations. For instance, if you realize you need to titleize all your titles, this is the place to do it.
Short Lived Task
Move reads from the old column to the new column
Stop writing to the old column
Another way I saw this done
Drop the old column
Fewer deploymentsThis is probably my bias showing (deployments are hard right now), but I think this could be done in three deployments
Renaming the ColumnIf your end goal is to restore the column name to it's original name you would then have to do the same set of steps again:
Sources
|
Describe the bug
We had a request by a researcher to attach several 2.8 Gb zip files to an existing object. We couldn't fulfill this request because of the way we were storing metadata about the file. We try to store the byte_size of the file (2,968,164,521) in an Integer (2,147,483,647), and it doesn't fit.
To Reproduce
Steps to reproduce the behavior:
item
for theItem
to attach the zip files.Expected behavior
Metadata attributes should not be a limitation for adding and ingesting files.
Additional context
#2617
https://github.com/ualbertalib/digital-preservation/issues/22
The text was updated successfully, but these errors were encountered: