diff --git a/db/migrate/20170627113331_create_images.rb b/db/migrate/20170627113331_create_images.rb new file mode 100644 index 000000000..66567845a --- /dev/null +++ b/db/migrate/20170627113331_create_images.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 240abcdaa..063641d00 100644 --- a/db/schema.rb +++ b/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"