Update old migrations to maintain consistency

After merge "Bump paperclip from 5.2.1 to 6.1.0 #3905" as indicated in
the release_notes columns type for attachments are changed from integer
to bigint.
For this reason we edit old migrations so that they continue to
generate integer as before.
This commit is contained in:
taitus
2020-08-31 12:31:08 +02:00
parent 3853557343
commit 574a5d0067
3 changed files with 13 additions and 8 deletions

View File

@@ -2,7 +2,10 @@ class CreateSiteCustomizationImages < ActiveRecord::Migration[4.2]
def change def change
create_table :site_customization_images do |t| create_table :site_customization_images do |t|
t.string :name, null: false t.string :name, null: false
t.attachment :image t.string :image_file_name
t.string :image_content_type
t.integer :image_file_size
t.datetime :image_updated_at
t.timestamps null: false t.timestamps null: false
end end

View File

@@ -1,14 +1,13 @@
class CreateImages < ActiveRecord::Migration[4.2] class CreateImages < ActiveRecord::Migration[4.2]
def up def change
create_table :images do |t| create_table :images do |t|
t.references :imageable, polymorphic: true, index: true t.references :imageable, polymorphic: true, index: true
t.string :title, limit: 80 t.string :title, limit: 80
t.timestamps null: false t.timestamps null: false
t.string :attachment_file_name
t.string :attachment_content_type
t.integer :attachment_file_size
t.datetime :attachment_updated_at
end end
add_attachment :images, :attachment
end
def down
remove_attachment :images, :attachment
end end
end end

View File

@@ -2,7 +2,10 @@ class CreateDocuments < ActiveRecord::Migration[4.2]
def change def change
create_table :documents do |t| create_table :documents do |t|
t.string :title t.string :title
t.attachment :attachment t.string :attachment_file_name
t.string :attachment_content_type
t.integer :attachment_file_size
t.datetime :attachment_updated_at
t.references :user, index: true, foreign_key: true t.references :user, index: true, foreign_key: true
t.references :documentable, polymorphic: true, index: true t.references :documentable, polymorphic: true, index: true