summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2017-08-02 04:11:35 +0200
committerGabriel Mazetto <brodock@gmail.com>2017-08-22 06:33:20 +0200
commit53403399577bdca0e8f0886fa62ce0e75c14a8e0 (patch)
tree4ba58b5848ef0ba9fb07ce88ec7a0a40564187b6 /db
parent950c87308aa7e9f3ae5bf84790d30d6fcb688fc8 (diff)
downloadgitlab-ce-53403399577bdca0e8f0886fa62ce0e75c14a8e0.tar.gz
Add UUID Storage to Project
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20170802013652_add_storage_fields_to_project.rb39
-rw-r--r--db/schema.rb3
2 files changed, 42 insertions, 0 deletions
diff --git a/db/migrate/20170802013652_add_storage_fields_to_project.rb b/db/migrate/20170802013652_add_storage_fields_to_project.rb
new file mode 100644
index 00000000000..269103cd472
--- /dev/null
+++ b/db/migrate/20170802013652_add_storage_fields_to_project.rb
@@ -0,0 +1,39 @@
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddStorageFieldsToProject < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ # When a migration requires downtime you **must** uncomment the following
+ # constant and define a short and easy to understand explanation as to why the
+ # migration requires downtime.
+ # DOWNTIME_REASON = ''
+
+ # When using the methods "add_concurrent_index", "remove_concurrent_index" or
+ # "add_column_with_default" you must disable the use of transactions
+ # as these methods can not run in an existing transaction.
+ # When using "add_concurrent_index" or "remove_concurrent_index" methods make sure
+ # that either of them is the _only_ method called in the migration,
+ # any other changes should go in a separate migration.
+ # This ensures that upon failure _only_ the index creation or removing fails
+ # and can be retried or reverted easily.
+ #
+ # To disable transactions uncomment the following line and remove these
+ # comments:
+ disable_ddl_transaction!
+
+ def up
+ # rubocop:disable Migration/AddColumnWithDefaultToLargeTable
+ add_column :projects, :uuid, :uuid
+ add_column_with_default :projects, :storage_version, :integer, default: 0, limit: 1
+ add_concurrent_index :projects, :uuid
+ end
+
+ def down
+ remove_column :projects, :uuid
+ remove_column :projects, :storage_version
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index c31bff3a8f2..dcd9532e4be 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1208,6 +1208,8 @@ ActiveRecord::Schema.define(version: 20170820100558) do
t.datetime "last_repository_updated_at"
t.string "ci_config_path"
t.text "delete_error"
+ t.uuid "uuid"
+ t.integer "storage_version", limit: 2, default: 0, null: false
end
add_index "projects", ["ci_id"], name: "index_projects_on_ci_id", using: :btree
@@ -1224,6 +1226,7 @@ ActiveRecord::Schema.define(version: 20170820100558) do
add_index "projects", ["pending_delete"], name: "index_projects_on_pending_delete", using: :btree
add_index "projects", ["runners_token"], name: "index_projects_on_runners_token", using: :btree
add_index "projects", ["star_count"], name: "index_projects_on_star_count", using: :btree
+ add_index "projects", ["uuid"], name: "index_projects_on_uuid", using: :btree
add_index "projects", ["visibility_level"], name: "index_projects_on_visibility_level", using: :btree
create_table "protected_branch_merge_access_levels", force: :cascade do |t|