Commit 3604fd38 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Improve migrations for maven packages feature

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent c94b0a46
......@@ -1922,23 +1922,22 @@ ActiveRecord::Schema.define(version: 20180810155213) do
end
create_table "packages_maven_metadata", id: :bigserial, force: :cascade do |t|
t.integer "package_id", limit: 8, null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "package_id", limit: 8, null: false
t.string "app_group", null: false
t.string "app_name", null: false
t.string "app_version"
t.text "path", null: false
end
add_index "packages_maven_metadata", ["package_id"], name: "index_packages_maven_metadata_on_package_id", using: :btree
add_index "packages_maven_metadata", ["path"], name: "index_packages_maven_metadata_on_path", using: :btree
add_index "packages_maven_metadata", ["package_id", "path"], name: "index_packages_maven_metadata_on_package_id_and_path", using: :btree
create_table "packages_package_files", id: :bigserial, force: :cascade do |t|
t.integer "package_id", limit: 8, null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "size", limit: 8
t.integer "package_id", limit: 8, null: false
t.integer "file_type"
t.integer "file_store"
t.binary "file_md5"
......@@ -1948,12 +1947,11 @@ ActiveRecord::Schema.define(version: 20180810155213) do
end
add_index "packages_package_files", ["package_id", "file_name"], name: "index_packages_package_files_on_package_id_and_file_name", using: :btree
add_index "packages_package_files", ["package_id"], name: "index_packages_package_files_on_package_id", using: :btree
create_table "packages_packages", id: :bigserial, force: :cascade do |t|
t.integer "project_id", null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.integer "project_id", null: false
t.string "name", null: false
t.string "version"
end
......
......@@ -8,7 +8,7 @@ class CreatePackagesPackageFiles < ActiveRecord::Migration
def up
create_table :packages_package_files, id: :bigserial do |t|
t.references :package, type: :bigint, index: true, null: false
t.references :package, type: :bigint, null: false
t.timestamps_with_timezone null: false
......
......@@ -8,15 +8,14 @@ class CreatePackagesMavenMetadata < ActiveRecord::Migration
def up
create_table :packages_maven_metadata, id: :bigserial do |t|
t.references :package, type: :bigint, index: true, null: false
t.references :package, type: :bigint, null: false
t.timestamps_with_timezone null: false
t.string :app_group, null: false
t.string :app_name, null: false
t.string :app_version
t.text :path, null: false
t.string :path, limit: 1024, null: false
end
add_concurrent_foreign_key :packages_maven_metadata, :packages_packages,
......
......@@ -7,17 +7,11 @@ class AddMoreIndicesToPackages < ActiveRecord::Migration
def up
add_concurrent_index :packages_package_files, [:package_id, :file_name]
add_concurrent_index :packages_maven_metadata, :path, length: text_index_length
add_concurrent_index :packages_maven_metadata, [:package_id, :path]
end
def down
remove_concurrent_index :packages_package_files, [:package_id, :file_name]
remove_concurrent_index :packages_maven_metadata, :path, length: text_index_length
end
private
def text_index_length
Gitlab::Database.mysql? ? 20 : nil
remove_concurrent_index :packages_maven_metadata, [:package_id, :path]
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment