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

Update columns type of attachment file #4115

Merged
merged 2 commits into from
Sep 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ class CreateSiteCustomizationImages < ActiveRecord::Migration[4.2]
def change
create_table :site_customization_images do |t|
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
end

Expand Down
11 changes: 5 additions & 6 deletions db/migrate/20170627113331_create_images.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
class CreateImages < ActiveRecord::Migration[4.2]
def up
def change
create_table :images do |t|
t.references :imageable, polymorphic: true, index: true
t.string :title, limit: 80
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
add_attachment :images, :attachment
end

def down
remove_attachment :images, :attachment
end
end
5 changes: 4 additions & 1 deletion db/migrate/20170720092638_create_documents.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ class CreateDocuments < ActiveRecord::Migration[4.2]
def change
create_table :documents do |t|
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 :documentable, polymorphic: true, index: true

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class ChangeAttachmentSizeFieldsToBigint < ActiveRecord::Migration[5.1]
def change
change_column :site_customization_images, :image_file_size, :bigint
change_column :images, :attachment_file_size, :bigint
change_column :documents, :attachment_file_size, :bigint
end
end
8 changes: 4 additions & 4 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20200519120717) do
ActiveRecord::Schema.define(version: 20200908084257) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -545,7 +545,7 @@
t.string "title"
t.string "attachment_file_name"
t.string "attachment_content_type"
t.integer "attachment_file_size"
t.bigint "attachment_file_size"
t.datetime "attachment_updated_at"
t.integer "user_id"
t.string "documentable_type"
Expand Down Expand Up @@ -641,7 +641,7 @@
t.datetime "updated_at", null: false
t.string "attachment_file_name"
t.string "attachment_content_type"
t.integer "attachment_file_size"
t.bigint "attachment_file_size"
t.datetime "attachment_updated_at"
t.integer "user_id"
t.index ["imageable_type", "imageable_id"], name: "index_images_on_imageable_type_and_imageable_id"
Expand Down Expand Up @@ -1347,7 +1347,7 @@
t.string "name", null: false
t.string "image_file_name"
t.string "image_content_type"
t.integer "image_file_size"
t.bigint "image_file_size"
t.datetime "image_updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
Expand Down