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 ...@@ -1922,23 +1922,22 @@ ActiveRecord::Schema.define(version: 20180810155213) do
end end
create_table "packages_maven_metadata", id: :bigserial, force: :cascade do |t| 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 "created_at", null: false
t.datetime_with_timezone "updated_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_group", null: false
t.string "app_name", null: false t.string "app_name", null: false
t.string "app_version" t.string "app_version"
t.text "path", null: false t.text "path", null: false
end end
add_index "packages_maven_metadata", ["package_id"], name: "index_packages_maven_metadata_on_package_id", using: :btree add_index "packages_maven_metadata", ["package_id", "path"], name: "index_packages_maven_metadata_on_package_id_and_path", using: :btree
add_index "packages_maven_metadata", ["path"], name: "index_packages_maven_metadata_on_path", using: :btree
create_table "packages_package_files", id: :bigserial, force: :cascade do |t| 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 "created_at", null: false
t.datetime_with_timezone "updated_at", null: false t.datetime_with_timezone "updated_at", null: false
t.integer "size", limit: 8 t.integer "size", limit: 8
t.integer "package_id", limit: 8, null: false
t.integer "file_type" t.integer "file_type"
t.integer "file_store" t.integer "file_store"
t.binary "file_md5" t.binary "file_md5"
...@@ -1948,12 +1947,11 @@ ActiveRecord::Schema.define(version: 20180810155213) do ...@@ -1948,12 +1947,11 @@ ActiveRecord::Schema.define(version: 20180810155213) do
end 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", "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| 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 "created_at", null: false
t.datetime_with_timezone "updated_at", null: false t.datetime_with_timezone "updated_at", null: false
t.integer "project_id", null: false
t.string "name", null: false t.string "name", null: false
t.string "version" t.string "version"
end end
......
...@@ -8,7 +8,7 @@ class CreatePackagesPackageFiles < ActiveRecord::Migration ...@@ -8,7 +8,7 @@ class CreatePackagesPackageFiles < ActiveRecord::Migration
def up def up
create_table :packages_package_files, id: :bigserial do |t| 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 t.timestamps_with_timezone null: false
......
...@@ -8,15 +8,14 @@ class CreatePackagesMavenMetadata < ActiveRecord::Migration ...@@ -8,15 +8,14 @@ class CreatePackagesMavenMetadata < ActiveRecord::Migration
def up def up
create_table :packages_maven_metadata, id: :bigserial do |t| 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.timestamps_with_timezone null: false
t.string :app_group, null: false t.string :app_group, null: false
t.string :app_name, null: false t.string :app_name, null: false
t.string :app_version t.string :app_version
t.string :path, limit: 1024, null: false
t.text :path, null: false
end end
add_concurrent_foreign_key :packages_maven_metadata, :packages_packages, add_concurrent_foreign_key :packages_maven_metadata, :packages_packages,
......
...@@ -7,17 +7,11 @@ class AddMoreIndicesToPackages < ActiveRecord::Migration ...@@ -7,17 +7,11 @@ class AddMoreIndicesToPackages < ActiveRecord::Migration
def up def up
add_concurrent_index :packages_package_files, [:package_id, :file_name] 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 end
def down def down
remove_concurrent_index :packages_package_files, [:package_id, :file_name] remove_concurrent_index :packages_package_files, [:package_id, :file_name]
remove_concurrent_index :packages_maven_metadata, :path, length: text_index_length remove_concurrent_index :packages_maven_metadata, [:package_id, :path]
end
private
def text_index_length
Gitlab::Database.mysql? ? 20 : nil
end end
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