From 4c622b71fd284058deee483bf0009f8179b792bc Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 22 Feb 2017 14:25:06 -0500 Subject: Add Upload model and UploadChecksumWorker worker --- db/migrate/20170130221926_create_uploads.rb | 20 ++++++++++++++++++++ db/schema.rb | 14 ++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 db/migrate/20170130221926_create_uploads.rb (limited to 'db') 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 -- cgit v1.2.1