Add Images table with paperclip attachment columns

This commit is contained in:
Bertocq
2017-06-27 15:53:16 +02:00
committed by Senén Rodero Rodríguez
parent 718336ce89
commit e38b06a003
2 changed files with 28 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
class CreateImages < ActiveRecord::Migration
def up
create_table :images do |t|
t.references :imageable, polymorphic: true, index: true
t.string :title, limit: 80
t.timestamps null: false
end
add_attachment :images, :attachment
end
def down
remove_attachment :images, :attachment
end
end

View File

@@ -388,6 +388,20 @@ ActiveRecord::Schema.define(version: 20170918231410) do
add_index "identities", ["user_id"], name: "index_identities_on_user_id", using: :btree
create_table "images", force: :cascade do |t|
t.integer "imageable_id"
t.string "imageable_type"
t.string "title", limit: 80
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "attachment_file_name"
t.string "attachment_content_type"
t.integer "attachment_file_size"
t.datetime "attachment_updated_at"
end
add_index "images", ["imageable_type", "imageable_id"], name: "index_images_on_imageable_type_and_imageable_id", using: :btree
create_table "legacy_legislations", force: :cascade do |t|
t.string "title"
t.text "body"