mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
Add ImageUpload model
This commit is contained in:
parent
77245b53e1
commit
eec596133b
3
app/models/image_upload.rb
Normal file
3
app/models/image_upload.rb
Normal file
@ -0,0 +1,3 @@
|
||||
class ImageUpload < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
end
|
||||
12
db/migrate/20170216211714_create_image_uploads.rb
Normal file
12
db/migrate/20170216211714_create_image_uploads.rb
Normal file
@ -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
|
||||
9
db/migrate/20170216211914_add_src_to_image_uploads.rb
Normal file
9
db/migrate/20170216211914_add_src_to_image_uploads.rb
Normal file
@ -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
|
||||
17
db/schema.rb
17
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"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user