From 52c3b8f31264230814d2ffa79d0987c1491676b3 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Thu, 8 Jun 2017 05:29:35 +0000 Subject: Merge branch 'zj-object-store-artifacts' into 'master' Object store for artifacts Closes gitlab-ce#29203 See merge request !1762 --- .../20170601163708_add_artifacts_store_to_ci_build.rb | 17 +++++++++++++++++ db/schema.rb | 2 ++ 2 files changed, 19 insertions(+) create mode 100644 db/migrate/20170601163708_add_artifacts_store_to_ci_build.rb (limited to 'db') diff --git a/db/migrate/20170601163708_add_artifacts_store_to_ci_build.rb b/db/migrate/20170601163708_add_artifacts_store_to_ci_build.rb new file mode 100644 index 00000000000..deba890a478 --- /dev/null +++ b/db/migrate/20170601163708_add_artifacts_store_to_ci_build.rb @@ -0,0 +1,17 @@ +class AddArtifactsStoreToCiBuild < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_column_with_default(:ci_builds, :artifacts_file_store, :integer, default: 1) + add_column_with_default(:ci_builds, :artifacts_metadata_store, :integer, default: 1) + end + + def down + remove_column(:ci_builds, :artifacts_file_store) + remove_column(:ci_builds, :artifacts_metadata_store) + end +end diff --git a/db/schema.rb b/db/schema.rb index 3dbe52c9c80..69e2a8cfd70 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -238,6 +238,8 @@ ActiveRecord::Schema.define(version: 20170707184244) do t.integer "auto_canceled_by_id" t.boolean "retried" t.integer "stage_id" + t.integer "artifacts_file_store", default: 1, null: false + t.integer "artifacts_metadata_store", default: 1, null: false end add_index "ci_builds", ["auto_canceled_by_id"], name: "index_ci_builds_on_auto_canceled_by_id", using: :btree -- cgit v1.2.1 From bc76062774f01208403685965f4d780da4e03ebb Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Thu, 7 Sep 2017 21:27:04 +0000 Subject: Merge branch 'jej/lfs-object-storage' into 'master' Can migrate LFS objects to S3 style object storage Closes #2841 See merge request !2760 --- ...20170825015534_add_file_store_to_lfs_objects.rb | 35 ++++++++++++++++++++++ db/schema.rb | 1 + 2 files changed, 36 insertions(+) create mode 100644 db/migrate/20170825015534_add_file_store_to_lfs_objects.rb (limited to 'db') diff --git a/db/migrate/20170825015534_add_file_store_to_lfs_objects.rb b/db/migrate/20170825015534_add_file_store_to_lfs_objects.rb new file mode 100644 index 00000000000..4d459ccab2c --- /dev/null +++ b/db/migrate/20170825015534_add_file_store_to_lfs_objects.rb @@ -0,0 +1,35 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddFileStoreToLfsObjects < 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 + add_column(:lfs_objects, :file_store, :integer) + end + + def down + remove_column(:lfs_objects, :file_store) + end +end diff --git a/db/schema.rb b/db/schema.rb index 74634d14ccb..9f293205a24 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -741,6 +741,7 @@ ActiveRecord::Schema.define(version: 20170905112933) do t.datetime "created_at" t.datetime "updated_at" t.string "file" + t.integer "file_store" end add_index "lfs_objects", ["oid"], name: "index_lfs_objects_on_oid", unique: true, using: :btree -- cgit v1.2.1 From 6ca02a41500790b3e9061dd8836540955b9aaf7c Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Tue, 5 Dec 2017 14:31:33 +0000 Subject: Merge branch 'zj-multiple-artifacts-ee' into 'master' Multiple artifacts ee See merge request gitlab-org/gitlab-ee!3276 --- db/migrate/20170918072949_add_file_store_job_artifacts.rb | 14 ++++++++++++++ db/schema.rb | 1 + 2 files changed, 15 insertions(+) create mode 100644 db/migrate/20170918072949_add_file_store_job_artifacts.rb (limited to 'db') diff --git a/db/migrate/20170918072949_add_file_store_job_artifacts.rb b/db/migrate/20170918072949_add_file_store_job_artifacts.rb new file mode 100644 index 00000000000..8c265bb6aca --- /dev/null +++ b/db/migrate/20170918072949_add_file_store_job_artifacts.rb @@ -0,0 +1,14 @@ +class AddFileStoreJobArtifacts < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + DOWNTIME = false + + def up + add_column(:ci_job_artifacts, :file_store, :integer) + end + + def down + remove_column(:ci_job_artifacts, :file_store) + end +end diff --git a/db/schema.rb b/db/schema.rb index 8846bbd975c..8aa6a87657e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -326,6 +326,7 @@ ActiveRecord::Schema.define(version: 20171205190711) do t.integer "project_id", null: false t.integer "job_id", null: false t.integer "file_type", null: false + t.integer "file_store" t.integer "size", limit: 8 t.datetime_with_timezone "created_at", null: false t.datetime_with_timezone "updated_at", null: false -- cgit v1.2.1 From a7dae52e9d27adde427ef8aa066c0761071a3cd9 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Fri, 2 Feb 2018 13:59:43 +0000 Subject: Merge branch '4163-move-uploads-to-object-storage' into 'master' Move uploads to object storage Closes #4163 See merge request gitlab-org/gitlab-ee!3867 --- .../20171214144320_add_store_column_to_uploads.rb | 12 ++++++++++++ .../20180119135717_add_uploader_index_to_uploads.rb | 20 ++++++++++++++++++++ db/schema.rb | 3 ++- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20171214144320_add_store_column_to_uploads.rb create mode 100644 db/migrate/20180119135717_add_uploader_index_to_uploads.rb (limited to 'db') diff --git a/db/migrate/20171214144320_add_store_column_to_uploads.rb b/db/migrate/20171214144320_add_store_column_to_uploads.rb new file mode 100644 index 00000000000..bad20dcdbcf --- /dev/null +++ b/db/migrate/20171214144320_add_store_column_to_uploads.rb @@ -0,0 +1,12 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddStoreColumnToUploads < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + add_column :uploads, :store, :integer + end +end diff --git a/db/migrate/20180119135717_add_uploader_index_to_uploads.rb b/db/migrate/20180119135717_add_uploader_index_to_uploads.rb new file mode 100644 index 00000000000..a678c3d049f --- /dev/null +++ b/db/migrate/20180119135717_add_uploader_index_to_uploads.rb @@ -0,0 +1,20 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddUploaderIndexToUploads < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + remove_concurrent_index :uploads, :path + add_concurrent_index :uploads, [:uploader, :path], using: :btree + end + + def down + remove_concurrent_index :uploads, [:uploader, :path] + add_concurrent_index :uploads, :path, using: :btree + end +end diff --git a/db/schema.rb b/db/schema.rb index 02c44bccc61..b6800ff926e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1760,11 +1760,12 @@ ActiveRecord::Schema.define(version: 20171230123729) do t.string "model_type" t.string "uploader", null: false t.datetime "created_at", null: false + t.integer "store" 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 + add_index "uploads", ["uploader", "path"], name: "index_uploads_on_uploader_and_path", using: :btree create_table "user_agent_details", force: :cascade do |t| t.string "user_agent", null: false -- cgit v1.2.1 From 8af23def1d6450420d06b8de54d23311a978de20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Wed, 28 Feb 2018 21:09:34 +0100 Subject: Revert "Merge branch '3867-port-to-ce' into 'master'" This reverts commit 54a575f1bbba44573ab92dc58a4242f1ee734c5d, reversing changes made to c63af942e5baf7849a94fa99da8494bcba28e3f8. --- .../20180119135717_add_uploader_index_to_uploads.rb | 20 -------------------- db/schema.rb | 2 +- 2 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 db/migrate/20180119135717_add_uploader_index_to_uploads.rb (limited to 'db') diff --git a/db/migrate/20180119135717_add_uploader_index_to_uploads.rb b/db/migrate/20180119135717_add_uploader_index_to_uploads.rb deleted file mode 100644 index a678c3d049f..00000000000 --- a/db/migrate/20180119135717_add_uploader_index_to_uploads.rb +++ /dev/null @@ -1,20 +0,0 @@ -# See http://doc.gitlab.com/ce/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddUploaderIndexToUploads < ActiveRecord::Migration - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - def up - remove_concurrent_index :uploads, :path - add_concurrent_index :uploads, [:uploader, :path], using: :btree - end - - def down - remove_concurrent_index :uploads, [:uploader, :path] - add_concurrent_index :uploads, :path, using: :btree - end -end diff --git a/db/schema.rb b/db/schema.rb index 01a2df13dd3..0d97b6f9ddd 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1755,7 +1755,7 @@ ActiveRecord::Schema.define(version: 20180201145907) do 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", ["uploader", "path"], name: "index_uploads_on_uploader_and_path", 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 -- cgit v1.2.1 From 0f1d348d683fdef6c36c3b244c85e59f582ff886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mica=C3=ABl=20Bergeron?= Date: Wed, 21 Feb 2018 11:43:21 -0500 Subject: port the object storage to CE --- db/schema.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'db') diff --git a/db/schema.rb b/db/schema.rb index fba0c710705..b957a67578a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -336,6 +336,7 @@ ActiveRecord::Schema.define(version: 20180216121030) do t.datetime_with_timezone "updated_at", null: false t.datetime_with_timezone "expire_at" t.string "file" + t.integer "file_store" end add_index "ci_job_artifacts", ["expire_at", "job_id"], name: "index_ci_job_artifacts_on_expire_at_and_job_id", using: :btree -- cgit v1.2.1 From 50c08d0eda6a1863e025b09c20dc2e4a38754ff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mica=C3=ABl=20Bergeron?= Date: Thu, 22 Feb 2018 10:45:59 -0500 Subject: fix the EE migrations --- ...20170825015534_add_file_store_to_lfs_objects.rb | 35 -------------------- .../20170918072949_add_file_store_job_artifacts.rb | 14 -------- .../20171214144320_add_store_column_to_uploads.rb | 12 ------- .../20180222152310_port_object_storage_to_ce.rb | 37 ++++++++++++++++++++++ db/schema.rb | 2 +- 5 files changed, 38 insertions(+), 62 deletions(-) delete mode 100644 db/migrate/20170825015534_add_file_store_to_lfs_objects.rb delete mode 100644 db/migrate/20170918072949_add_file_store_job_artifacts.rb delete mode 100644 db/migrate/20171214144320_add_store_column_to_uploads.rb create mode 100644 db/migrate/20180222152310_port_object_storage_to_ce.rb (limited to 'db') diff --git a/db/migrate/20170825015534_add_file_store_to_lfs_objects.rb b/db/migrate/20170825015534_add_file_store_to_lfs_objects.rb deleted file mode 100644 index 4d459ccab2c..00000000000 --- a/db/migrate/20170825015534_add_file_store_to_lfs_objects.rb +++ /dev/null @@ -1,35 +0,0 @@ -# See http://doc.gitlab.com/ce/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddFileStoreToLfsObjects < 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 - add_column(:lfs_objects, :file_store, :integer) - end - - def down - remove_column(:lfs_objects, :file_store) - end -end diff --git a/db/migrate/20170918072949_add_file_store_job_artifacts.rb b/db/migrate/20170918072949_add_file_store_job_artifacts.rb deleted file mode 100644 index 8c265bb6aca..00000000000 --- a/db/migrate/20170918072949_add_file_store_job_artifacts.rb +++ /dev/null @@ -1,14 +0,0 @@ -class AddFileStoreJobArtifacts < ActiveRecord::Migration - include Gitlab::Database::MigrationHelpers - - disable_ddl_transaction! - DOWNTIME = false - - def up - add_column(:ci_job_artifacts, :file_store, :integer) - end - - def down - remove_column(:ci_job_artifacts, :file_store) - end -end diff --git a/db/migrate/20171214144320_add_store_column_to_uploads.rb b/db/migrate/20171214144320_add_store_column_to_uploads.rb deleted file mode 100644 index bad20dcdbcf..00000000000 --- a/db/migrate/20171214144320_add_store_column_to_uploads.rb +++ /dev/null @@ -1,12 +0,0 @@ -# See http://doc.gitlab.com/ce/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class AddStoreColumnToUploads < ActiveRecord::Migration - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def change - add_column :uploads, :store, :integer - end -end diff --git a/db/migrate/20180222152310_port_object_storage_to_ce.rb b/db/migrate/20180222152310_port_object_storage_to_ce.rb new file mode 100644 index 00000000000..aa1e15072b8 --- /dev/null +++ b/db/migrate/20180222152310_port_object_storage_to_ce.rb @@ -0,0 +1,37 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class PortObjectStorageToCe < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + def up + unless column_exists?(:ci_job_artifacts, :file_store) + add_column(:ci_job_artifacts, :file_store, :integer) + end + + unless column_exists?(:lfs_objects, :file_store) + add_column(:lfs_objects, :file_store, :integer) + end + + unless column_exists?(:uploads, :store) + add_column(:uploads, :store, :integer) + end + end + + def down + if column_exists?(:ci_job_artifacts, :file_store) + remove_column(:ci_job_artifacts, :file_store) + end + + if column_exists?(:lfs_objects, :file_store) + remove_column(:lfs_objects, :file_store) + end + + if column_exists?(:uploads, :store) + remove_column(:uploads, :store) + end + end +end diff --git a/db/schema.rb b/db/schema.rb index b957a67578a..5f3a11af49b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180216121030) do +ActiveRecord::Schema.define(version: 20180222152310) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" -- cgit v1.2.1 From e43d7d2b4d4ccae4e7c7c89b68b6dc3ae8f34bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mica=C3=ABl=20Bergeron?= Date: Thu, 22 Feb 2018 16:08:35 -0500 Subject: fix the prepare_untracked_uploads_spec from using the EE schema --- db/schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'db') diff --git a/db/schema.rb b/db/schema.rb index 5f3a11af49b..74dbb11c89b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1777,9 +1777,9 @@ ActiveRecord::Schema.define(version: 20180222152310) do t.string "model_type" t.string "uploader", null: false t.datetime "created_at", null: false - t.integer "store" t.string "mount_point" t.string "secret" + t.integer "store" end add_index "uploads", ["checksum"], name: "index_uploads_on_checksum", using: :btree -- cgit v1.2.1 From 40a3b467f25df62fab4b92a3700846f06ef7534c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mica=C3=ABl=20Bergeron?= Date: Mon, 26 Feb 2018 14:14:00 -0500 Subject: add the Ci::Build `*_store` column --- .../20180222152310_port_object_storage_to_ce.rb | 42 +++++++++++----------- db/schema.rb | 2 ++ 2 files changed, 23 insertions(+), 21 deletions(-) (limited to 'db') diff --git a/db/migrate/20180222152310_port_object_storage_to_ce.rb b/db/migrate/20180222152310_port_object_storage_to_ce.rb index aa1e15072b8..f2e2e53ed8c 100644 --- a/db/migrate/20180222152310_port_object_storage_to_ce.rb +++ b/db/migrate/20180222152310_port_object_storage_to_ce.rb @@ -7,31 +7,31 @@ class PortObjectStorageToCe < ActiveRecord::Migration # Set this constant to true if this migration requires downtime. DOWNTIME = false - def up - unless column_exists?(:ci_job_artifacts, :file_store) - add_column(:ci_job_artifacts, :file_store, :integer) - end - - unless column_exists?(:lfs_objects, :file_store) - add_column(:lfs_objects, :file_store, :integer) - end + def add_column_idempotent(table, column, *defs) + return if column_exists?(table, column) - unless column_exists?(:uploads, :store) - add_column(:uploads, :store, :integer) - end + add_column(table, column, *defs) end - def down - if column_exists?(:ci_job_artifacts, :file_store) - remove_column(:ci_job_artifacts, :file_store) - end + def remove_column_idempotent(table, column) + return unless column_exists?(table, column) + + remove_column(table, column) + end - if column_exists?(:lfs_objects, :file_store) - remove_column(:lfs_objects, :file_store) - end + def up + add_column_idempotent(:ci_job_artifacts, :file_store, :integer) + add_column_idempotent(:ci_builds, :artifacts_file_store, :integer) + add_column_idempotent(:ci_builds, :artifacts_metadata_store, :integer) + add_column_idempotent(:lfs_objects, :file_store, :integer) + add_column_idempotent(:uploads, :store, :integer) + end - if column_exists?(:uploads, :store) - remove_column(:uploads, :store) - end + def down + remove_column_idempotent(:ci_job_artifacts, :file_store) + remove_column_idempotent(:ci_builds, :artifacts_file_store) + remove_column_idempotent(:ci_builds, :artifacts_metadata_store) + remove_column_idempotent(:lfs_objects, :file_store) + remove_column_idempotent(:uploads, :store) end end diff --git a/db/schema.rb b/db/schema.rb index 74dbb11c89b..3af701d0ed9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -294,6 +294,8 @@ ActiveRecord::Schema.define(version: 20180222152310) do t.integer "artifacts_metadata_store", default: 1, null: false t.boolean "protected" t.integer "failure_reason" + t.integer "artifacts_file_store" + t.integer "artifacts_metadata_store" end add_index "ci_builds", ["artifacts_expire_at"], name: "index_ci_builds_on_artifacts_expire_at", where: "(artifacts_file <> ''::text)", using: :btree -- cgit v1.2.1 From a3e46d9b68ebe2b4c78425fa3a77ebcb3133eef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mica=C3=ABl=20Bergeron?= Date: Tue, 27 Feb 2018 14:17:42 -0500 Subject: rework the migration to use the EE ones --- ...20170825015534_add_file_store_to_lfs_objects.rb | 31 ++++++++++++++++++ .../20170918072949_add_file_store_job_artifacts.rb | 10 ++++++ .../20171214144320_add_store_column_to_uploads.rb | 12 +++++++ .../20180222152310_port_object_storage_to_ce.rb | 37 ---------------------- db/schema.rb | 2 +- 5 files changed, 54 insertions(+), 38 deletions(-) create mode 100644 db/migrate/20170825015534_add_file_store_to_lfs_objects.rb create mode 100644 db/migrate/20170918072949_add_file_store_job_artifacts.rb create mode 100644 db/migrate/20171214144320_add_store_column_to_uploads.rb delete mode 100644 db/migrate/20180222152310_port_object_storage_to_ce.rb (limited to 'db') diff --git a/db/migrate/20170825015534_add_file_store_to_lfs_objects.rb b/db/migrate/20170825015534_add_file_store_to_lfs_objects.rb new file mode 100644 index 00000000000..41bb031014f --- /dev/null +++ b/db/migrate/20170825015534_add_file_store_to_lfs_objects.rb @@ -0,0 +1,31 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddFileStoreToLfsObjects < 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 change + add_column(:lfs_objects, :file_store, :integer) + end +end diff --git a/db/migrate/20170918072949_add_file_store_job_artifacts.rb b/db/migrate/20170918072949_add_file_store_job_artifacts.rb new file mode 100644 index 00000000000..b1f1bea6deb --- /dev/null +++ b/db/migrate/20170918072949_add_file_store_job_artifacts.rb @@ -0,0 +1,10 @@ +class AddFileStoreJobArtifacts < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + disable_ddl_transaction! + DOWNTIME = false + + def change + add_column(:ci_job_artifacts, :file_store, :integer) + end +end diff --git a/db/migrate/20171214144320_add_store_column_to_uploads.rb b/db/migrate/20171214144320_add_store_column_to_uploads.rb new file mode 100644 index 00000000000..e35798e2c41 --- /dev/null +++ b/db/migrate/20171214144320_add_store_column_to_uploads.rb @@ -0,0 +1,12 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddStoreColumnToUploads < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + add_column(:uploads, :store, :integer) + end +end diff --git a/db/migrate/20180222152310_port_object_storage_to_ce.rb b/db/migrate/20180222152310_port_object_storage_to_ce.rb deleted file mode 100644 index f2e2e53ed8c..00000000000 --- a/db/migrate/20180222152310_port_object_storage_to_ce.rb +++ /dev/null @@ -1,37 +0,0 @@ -# See http://doc.gitlab.com/ce/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class PortObjectStorageToCe < ActiveRecord::Migration - include Gitlab::Database::MigrationHelpers - - # Set this constant to true if this migration requires downtime. - DOWNTIME = false - - def add_column_idempotent(table, column, *defs) - return if column_exists?(table, column) - - add_column(table, column, *defs) - end - - def remove_column_idempotent(table, column) - return unless column_exists?(table, column) - - remove_column(table, column) - end - - def up - add_column_idempotent(:ci_job_artifacts, :file_store, :integer) - add_column_idempotent(:ci_builds, :artifacts_file_store, :integer) - add_column_idempotent(:ci_builds, :artifacts_metadata_store, :integer) - add_column_idempotent(:lfs_objects, :file_store, :integer) - add_column_idempotent(:uploads, :store, :integer) - end - - def down - remove_column_idempotent(:ci_job_artifacts, :file_store) - remove_column_idempotent(:ci_builds, :artifacts_file_store) - remove_column_idempotent(:ci_builds, :artifacts_metadata_store) - remove_column_idempotent(:lfs_objects, :file_store) - remove_column_idempotent(:uploads, :store) - end -end diff --git a/db/schema.rb b/db/schema.rb index 3af701d0ed9..46f2558e7ca 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180222152310) do +ActiveRecord::Schema.define(version: 20180213131630) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" -- cgit v1.2.1 From 0d458b96e8349a50877ebd55932bf806e93caa21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mica=C3=ABl=20Bergeron?= Date: Thu, 1 Mar 2018 16:30:31 -0500 Subject: remove geo specific code --- db/schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'db') diff --git a/db/schema.rb b/db/schema.rb index 46f2558e7ca..5ce6a015e83 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20180213131630) do +ActiveRecord::Schema.define(version: 20180216121030) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" -- cgit v1.2.1 From 4484587ef8c9bf63c60359a0980dda95e854b744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mica=C3=ABl=20Bergeron?= Date: Fri, 2 Mar 2018 13:21:03 -0500 Subject: another round of EE code removal --- db/schema.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'db') diff --git a/db/schema.rb b/db/schema.rb index 5ce6a015e83..db6360089a8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -290,12 +290,10 @@ ActiveRecord::Schema.define(version: 20180216121030) do t.integer "auto_canceled_by_id" t.boolean "retried" t.integer "stage_id" - t.integer "artifacts_file_store", default: 1, null: false - t.integer "artifacts_metadata_store", default: 1, null: false - t.boolean "protected" - t.integer "failure_reason" t.integer "artifacts_file_store" t.integer "artifacts_metadata_store" + t.boolean "protected" + t.integer "failure_reason" end add_index "ci_builds", ["artifacts_expire_at"], name: "index_ci_builds_on_artifacts_expire_at", where: "(artifacts_file <> ''::text)", using: :btree @@ -338,7 +336,6 @@ ActiveRecord::Schema.define(version: 20180216121030) do t.datetime_with_timezone "updated_at", null: false t.datetime_with_timezone "expire_at" t.string "file" - t.integer "file_store" end add_index "ci_job_artifacts", ["expire_at", "job_id"], name: "index_ci_job_artifacts_on_expire_at_and_job_id", using: :btree -- cgit v1.2.1 From 44f37504fb229ab78606a5fd11f75316ebc2667b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mica=C3=ABl=20Bergeron?= Date: Fri, 9 Mar 2018 10:09:00 -0500 Subject: Backport ee-40781-os-to-ce --- .../20170601163708_add_artifacts_store_to_ci_build.rb | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'db') diff --git a/db/migrate/20170601163708_add_artifacts_store_to_ci_build.rb b/db/migrate/20170601163708_add_artifacts_store_to_ci_build.rb index deba890a478..e82109190a7 100644 --- a/db/migrate/20170601163708_add_artifacts_store_to_ci_build.rb +++ b/db/migrate/20170601163708_add_artifacts_store_to_ci_build.rb @@ -3,15 +3,8 @@ class AddArtifactsStoreToCiBuild < ActiveRecord::Migration DOWNTIME = false - disable_ddl_transaction! - - def up - add_column_with_default(:ci_builds, :artifacts_file_store, :integer, default: 1) - add_column_with_default(:ci_builds, :artifacts_metadata_store, :integer, default: 1) - end - - def down - remove_column(:ci_builds, :artifacts_file_store) - remove_column(:ci_builds, :artifacts_metadata_store) + def change + add_column(:ci_builds, :artifacts_file_store, :integer) + add_column(:ci_builds, :artifacts_metadata_store, :integer) end end -- cgit v1.2.1