Add Images table with paperclip attachment columns
This commit is contained in:
committed by
Senén Rodero Rodríguez
parent
718336ce89
commit
e38b06a003
14
db/migrate/20170627113331_create_images.rb
Normal file
14
db/migrate/20170627113331_create_images.rb
Normal 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
|
||||
14
db/schema.rb
14
db/schema.rb
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user