diff options
author | Robert Speicher <rspeicher@gmail.com> | 2017-02-22 22:25:06 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2017-03-06 22:41:09 +0300 |
commit | 4c622b71fd284058deee483bf0009f8179b792bc (patch) | |
tree | 306cc2ffb5eec2d4fc972b33d14be2baf3959718 /db | |
parent | 2a2b24d5a7687abf7e7517eb011ba427852d6df0 (diff) |
Add Upload model and UploadChecksumWorker worker
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20170130221926_create_uploads.rb | 20 | ||||
-rw-r--r-- | db/schema.rb | 14 |
2 files changed, 34 insertions, 0 deletions
diff --git a/db/migrate/20170130221926_create_uploads.rb b/db/migrate/20170130221926_create_uploads.rb new file mode 100644 index 00000000000..6f06c5dd840 --- /dev/null +++ b/db/migrate/20170130221926_create_uploads.rb @@ -0,0 +1,20 @@ +class CreateUploads < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :uploads do |t| + t.integer :size, limit: 8, null: false + t.string :path, null: false + t.string :checksum, limit: 64 + t.references :model, polymorphic: true + t.string :uploader, null: false + t.datetime :created_at, null: false + end + + add_index :uploads, :path + add_index :uploads, :checksum + add_index :uploads, [:model_id, :model_type] + end +end diff --git a/db/schema.rb b/db/schema.rb index 6f7dd3e4768..9f31ee8e6c5 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1214,6 +1214,20 @@ ActiveRecord::Schema.define(version: 20170306170512) do add_index "u2f_registrations", ["key_handle"], name: "index_u2f_registrations_on_key_handle", using: :btree add_index "u2f_registrations", ["user_id"], name: "index_u2f_registrations_on_user_id", using: :btree + create_table "uploads", force: :cascade do |t| + t.integer "size", limit: 8, null: false + t.string "path", null: false + t.string "checksum", limit: 64 + t.integer "model_id" + t.string "model_type" + t.string "uploader", null: false + t.datetime "created_at", null: false + end + + add_index "uploads", ["checksum"], name: "index_uploads_on_checksum", using: :btree + add_index "uploads", ["model_id", "model_type"], name: "index_uploads_on_model_id_and_model_type", using: :btree + add_index "uploads", ["path"], name: "index_uploads_on_path", using: :btree + create_table "user_agent_details", force: :cascade do |t| t.string "user_agent", null: false t.string "ip_address", null: false |