diff --git a/app/models/image_upload.rb b/app/models/image_upload.rb new file mode 100644 index 00000000..29e2cf45 --- /dev/null +++ b/app/models/image_upload.rb @@ -0,0 +1,3 @@ +class ImageUpload < ActiveRecord::Base + belongs_to :user +end diff --git a/db/migrate/20170216211714_create_image_uploads.rb b/db/migrate/20170216211714_create_image_uploads.rb new file mode 100644 index 00000000..8978c76e --- /dev/null +++ b/db/migrate/20170216211714_create_image_uploads.rb @@ -0,0 +1,12 @@ +class CreateImageUploads < ActiveRecord::Migration + def change + create_table :image_uploads do |t| + t.string :privacy + t.references :user, index: true, foreign_key: true + t.string :content_type + t.integer :content_id + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20170216211914_add_src_to_image_uploads.rb b/db/migrate/20170216211914_add_src_to_image_uploads.rb new file mode 100644 index 00000000..18048831 --- /dev/null +++ b/db/migrate/20170216211914_add_src_to_image_uploads.rb @@ -0,0 +1,9 @@ +class AddSrcToImageUploads < ActiveRecord::Migration + def self.up + add_attachment :image_uploads, :src + end + + def self.down + remove_attachment :image_uploads, :src + end +end diff --git a/db/schema.rb b/db/schema.rb index 75ee822c..2044e9ae 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170201151923) do +ActiveRecord::Schema.define(version: 20170216211914) do create_table "archenemyships", force: :cascade do |t| t.integer "user_id" @@ -295,6 +295,21 @@ ActiveRecord::Schema.define(version: 20170201151923) do t.integer "headquarter_id" end + create_table "image_uploads", force: :cascade do |t| + t.string "privacy" + t.integer "user_id" + t.string "content_type" + t.integer "content_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "src_file_name" + t.string "src_content_type" + t.integer "src_file_size" + t.datetime "src_updated_at" + end + + add_index "image_uploads", ["user_id"], name: "index_image_uploads_on_user_id" + create_table "items", force: :cascade do |t| t.string "name", null: false t.string "item_type"