diff options
author | Toon Claes <toon@gitlab.com> | 2018-11-29 16:08:14 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-11-29 16:08:14 +0000 |
commit | 198fdc54789dcb24efb0622a23e6931d83e1faa6 (patch) | |
tree | 82c4d1926bd246fb857bb5ad9adaf68c45982dd5 /db | |
parent | 6775dafa3816239f6fa1b12428df42572be5a158 (diff) | |
download | gitlab-ce-198fdc54789dcb24efb0622a23e6931d83e1faa6.tar.gz |
Store hashed storage paths in the database
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20181122160027_create_project_repositories.rb | 18 | ||||
-rw-r--r-- | db/schema.rb | 11 |
2 files changed, 29 insertions, 0 deletions
diff --git a/db/migrate/20181122160027_create_project_repositories.rb b/db/migrate/20181122160027_create_project_repositories.rb new file mode 100644 index 00000000000..e42cef9b1c6 --- /dev/null +++ b/db/migrate/20181122160027_create_project_repositories.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class CreateProjectRepositories < ActiveRecord::Migration[5.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :project_repositories, id: :bigserial do |t| + t.references :shard, null: false, index: true, foreign_key: { on_delete: :restrict } + t.string :disk_path, null: false, index: { unique: true } + t.references :project, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade } + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 4f9588fd86b..995619bdc69 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1601,6 +1601,15 @@ ActiveRecord::Schema.define(version: 20181126153547) do t.index ["status"], name: "index_project_mirror_data_on_status", using: :btree end + create_table "project_repositories", id: :bigserial, force: :cascade do |t| + t.integer "shard_id", null: false + t.string "disk_path", null: false + t.integer "project_id", null: false + t.index ["disk_path"], name: "index_project_repositories_on_disk_path", unique: true, using: :btree + t.index ["project_id"], name: "index_project_repositories_on_project_id", unique: true, using: :btree + t.index ["shard_id"], name: "index_project_repositories_on_shard_id", using: :btree + end + create_table "project_statistics", force: :cascade do |t| t.integer "project_id", null: false t.integer "namespace_id", null: false @@ -2385,6 +2394,8 @@ ActiveRecord::Schema.define(version: 20181126153547) do add_foreign_key "project_group_links", "projects", name: "fk_daa8cee94c", on_delete: :cascade add_foreign_key "project_import_data", "projects", name: "fk_ffb9ee3a10", on_delete: :cascade add_foreign_key "project_mirror_data", "projects", on_delete: :cascade + add_foreign_key "project_repositories", "projects", on_delete: :cascade + add_foreign_key "project_repositories", "shards", on_delete: :restrict add_foreign_key "project_statistics", "projects", on_delete: :cascade add_foreign_key "projects", "pool_repositories", name: "fk_6e5c14658a", on_delete: :nullify add_foreign_key "prometheus_metrics", "projects", on_delete: :cascade |