Commit aa5d0146 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch...

Merge branch '341758-use-structure-sql-instead-of-schema-rb-for-the-geo-tracking-database' into 'master'

Convert ee/geo/db/schema.rb to ee/geo/db/structure.sql

See merge request gitlab-org/gitlab!71222
parents 0cec0605 e900df0b
......@@ -109,7 +109,7 @@ Geo secondary sites have a [Geo tracking database](https://gitlab.com/gitlab-org
bin/rake geo:db:migrate
```
- [ ] Be sure to commit the relevant changes in `ee/db/geo/schema.rb`
- [ ] Be sure to commit the relevant changes in `ee/db/geo/structure.sql`
### Add verification state fields on the Geo primary site
......
......@@ -110,7 +110,7 @@ Geo secondary sites have a [Geo tracking database](https://gitlab.com/gitlab-org
bin/rake geo:db:migrate
```
- [ ] Be sure to commit the relevant changes in `ee/db/geo/schema.rb`
- [ ] Be sure to commit the relevant changes in `ee/db/geo/structure.sql`
### Add verification state fields on the Geo primary site
......
......@@ -28,7 +28,6 @@ AllCops:
- 'node_modules/**/*'
- 'db/fixtures/**/*'
- 'db/schema.rb'
- 'ee/db/geo/schema.rb'
- 'tmp/**/*'
- 'bin/**/*'
- 'generator_templates/**/*'
......
......@@ -33,7 +33,7 @@ MSG
DATABASE_APPROVED_LABEL = 'database::approved'
non_geo_db_schema_updated = !git.modified_files.grep(%r{\Adb/structure\.sql}).empty?
geo_db_schema_updated = !git.modified_files.grep(%r{\Aee/db/geo/schema\.rb}).empty?
geo_db_schema_updated = !git.modified_files.grep(%r{\Aee/db/geo/structure\.sql}).empty?
non_geo_migration_created = !git.added_files.grep(%r{\A(db/(post_)?migrate)/}).empty?
geo_migration_created = !git.added_files.grep(%r{\Aee/db/geo/(post_)?migrate/}).empty?
......@@ -45,7 +45,7 @@ if non_geo_migration_created && !non_geo_db_schema_updated
end
if geo_migration_created && !geo_db_schema_updated
warn format(format_str, migrations: 'Geo migrations', schema: helper.html_link("ee/db/geo/schema.rb"))
warn format(format_str, migrations: 'Geo migrations', schema: helper.html_link("ee/db/geo/structure.sql"))
end
return unless helper.ci?
......
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `rails
# db:schema:load`. When creating a new database, `rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.
# frozen_string_literal: true
ActiveRecord::Schema.define(version: 2021_08_20_152707) do
# Disabled in favour of ee/db/geo/structure.sql
# Please refer to https://gitlab.com/gitlab-org/gitlab/-/issues/341758 for details
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "container_repository_registry", id: :serial, force: :cascade do |t|
t.integer "container_repository_id", null: false
t.string "state"
t.integer "retry_count", default: 0
t.string "last_sync_failure"
t.datetime "retry_at"
t.datetime "last_synced_at"
t.datetime "created_at", null: false
t.index ["container_repository_id"], name: "index_container_repository_registry_repository_id_unique", unique: true
t.index ["retry_at"], name: "index_container_repository_registry_on_retry_at"
t.index ["state"], name: "index_container_repository_registry_on_state"
end
create_table "design_registry", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.string "state", limit: 20
t.integer "retry_count", default: 0
t.string "last_sync_failure"
t.boolean "force_to_redownload"
t.boolean "missing_on_primary"
t.datetime "retry_at"
t.datetime "last_synced_at"
t.datetime "created_at", null: false
t.index ["project_id"], name: "index_design_registry_on_project_id", unique: true
t.index ["retry_at"], name: "index_design_registry_on_retry_at"
t.index ["state"], name: "index_design_registry_on_state"
end
create_table "event_log_states", primary_key: "event_id", force: :cascade do |t|
t.datetime "created_at", null: false
end
create_table "file_registry", id: :serial, force: :cascade do |t|
t.string "file_type", null: false
t.integer "file_id", null: false
t.bigint "bytes"
t.string "sha256"
t.datetime "created_at", null: false
t.boolean "success", default: false, null: false
t.integer "retry_count", default: 0
t.datetime "retry_at"
t.boolean "missing_on_primary", default: false, null: false
t.integer "state", limit: 2, default: 0, null: false
t.datetime_with_timezone "last_synced_at"
t.string "last_sync_failure", limit: 255
t.index ["file_type", "file_id"], name: "index_file_registry_on_file_type_and_file_id", unique: true
t.index ["file_type"], name: "index_file_registry_on_file_type"
t.index ["retry_at"], name: "index_file_registry_on_retry_at"
t.index ["success"], name: "index_file_registry_on_success"
end
create_table "group_wiki_repository_registry", force: :cascade do |t|
t.datetime_with_timezone "retry_at"
t.datetime_with_timezone "last_synced_at"
t.datetime_with_timezone "created_at", null: false
t.bigint "group_wiki_repository_id", null: false
t.integer "state", limit: 2, default: 0, null: false
t.integer "retry_count", limit: 2, default: 0
t.text "last_sync_failure"
t.boolean "force_to_redownload"
t.boolean "missing_on_primary"
t.index ["group_wiki_repository_id"], name: "index_g_wiki_repository_registry_on_group_wiki_repository_id", unique: true
t.index ["retry_at"], name: "index_group_wiki_repository_registry_on_retry_at"
t.index ["state"], name: "index_group_wiki_repository_registry_on_state"
end
create_table "job_artifact_registry", id: :serial, force: :cascade do |t|
t.datetime_with_timezone "created_at"
t.datetime_with_timezone "retry_at"
t.bigint "bytes"
t.integer "artifact_id"
t.integer "retry_count"
t.boolean "success"
t.string "sha256"
t.boolean "missing_on_primary", default: false, null: false
t.index ["artifact_id"], name: "index_job_artifact_registry_on_artifact_id"
t.index ["retry_at"], name: "index_job_artifact_registry_on_retry_at"
t.index ["success"], name: "index_job_artifact_registry_on_success"
end
create_table "lfs_object_registry", force: :cascade do |t|
t.datetime_with_timezone "created_at"
t.datetime_with_timezone "retry_at"
t.bigint "bytes"
t.integer "lfs_object_id"
t.integer "retry_count", default: 0
t.boolean "missing_on_primary", default: false, null: false
t.boolean "success", default: false, null: false
t.binary "sha256"
t.integer "state", limit: 2, default: 0, null: false
t.datetime_with_timezone "last_synced_at"
t.text "last_sync_failure"
t.index ["lfs_object_id"], name: "index_lfs_object_registry_on_lfs_object_id", unique: true
t.index ["retry_at"], name: "index_lfs_object_registry_on_retry_at"
t.index ["state"], name: "index_state_in_lfs_objects"
t.index ["success"], name: "index_lfs_object_registry_on_success"
end
create_table "merge_request_diff_registry", force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "retry_at"
t.datetime_with_timezone "last_synced_at"
t.bigint "merge_request_diff_id", null: false
t.integer "state", limit: 2, default: 0, null: false
t.integer "retry_count", limit: 2, default: 0
t.text "last_sync_failure"
t.datetime_with_timezone "verification_started_at"
t.datetime_with_timezone "verified_at"
t.datetime_with_timezone "verification_retry_at"
t.integer "verification_retry_count"
t.integer "verification_state", limit: 2, default: 0, null: false
t.boolean "checksum_mismatch"
t.binary "verification_checksum"
t.binary "verification_checksum_mismatched"
t.string "verification_failure", limit: 255
t.index ["merge_request_diff_id"], name: "index_merge_request_diff_registry_on_mr_diff_id", unique: true
t.index ["retry_at"], name: "index_merge_request_diff_registry_on_retry_at"
t.index ["state"], name: "index_merge_request_diff_registry_on_state"
t.index ["verification_retry_at"], name: "merge_request_diff_registry_failed_verification", order: "NULLS FIRST", where: "((state = 2) AND (verification_state = 3))"
t.index ["verification_state"], name: "merge_request_diff_registry_needs_verification", where: "((state = 2) AND (verification_state = ANY (ARRAY[0, 3])))"
t.index ["verified_at"], name: "merge_request_diff_registry_pending_verification", order: "NULLS FIRST", where: "((state = 2) AND (verification_state = 0))"
end
create_table "package_file_registry", id: :serial, force: :cascade do |t|
t.integer "package_file_id", null: false
t.integer "state", default: 0, null: false
t.integer "retry_count", default: 0
t.string "last_sync_failure", limit: 255
t.datetime_with_timezone "retry_at"
t.datetime_with_timezone "last_synced_at"
t.datetime_with_timezone "created_at", null: false
t.string "verification_failure", limit: 255
t.binary "verification_checksum"
t.boolean "checksum_mismatch"
t.binary "verification_checksum_mismatched"
t.integer "verification_retry_count"
t.datetime_with_timezone "verified_at"
t.datetime_with_timezone "verification_retry_at"
t.integer "verification_state", limit: 2, default: 0, null: false
t.datetime_with_timezone "verification_started_at"
t.index ["package_file_id"], name: "index_package_file_registry_on_repository_id"
t.index ["retry_at"], name: "index_package_file_registry_on_retry_at"
t.index ["state"], name: "index_package_file_registry_on_state"
t.index ["verification_retry_at"], name: "package_file_registry_failed_verification", order: "NULLS FIRST", where: "((state = 2) AND (verification_state = 3))"
t.index ["verification_state"], name: "package_file_registry_needs_verification", where: "((state = 2) AND (verification_state = ANY (ARRAY[0, 3])))"
t.index ["verified_at"], name: "package_file_registry_pending_verification", order: "NULLS FIRST", where: "((state = 2) AND (verification_state = 0))"
end
create_table "pages_deployment_registry", force: :cascade do |t|
t.bigint "pages_deployment_id", null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "last_synced_at"
t.datetime_with_timezone "retry_at"
t.integer "state", limit: 2, default: 0, null: false
t.integer "retry_count", limit: 2, default: 0, null: false
t.string "last_sync_failure", limit: 255
t.index ["pages_deployment_id"], name: "index_pages_deployment_registry_on_pages_deployment_id", unique: true
t.index ["retry_at"], name: "index_pages_deployment_registry_on_retry_at"
t.index ["state"], name: "index_pages_deployment_registry_on_state"
end
create_table "pipeline_artifact_registry", force: :cascade do |t|
t.bigint "pipeline_artifact_id", null: false
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "last_synced_at"
t.datetime_with_timezone "retry_at"
t.datetime_with_timezone "verified_at"
t.datetime_with_timezone "verification_started_at"
t.datetime_with_timezone "verification_retry_at"
t.integer "state", limit: 2, default: 0, null: false
t.integer "verification_state", limit: 2, default: 0, null: false
t.integer "retry_count", limit: 2, default: 0
t.integer "verification_retry_count", limit: 2, default: 0
t.boolean "checksum_mismatch", default: false, null: false
t.binary "verification_checksum"
t.binary "verification_checksum_mismatched"
t.string "verification_failure", limit: 255
t.string "last_sync_failure", limit: 255
t.index ["pipeline_artifact_id"], name: "index_pipeline_artifact_registry_on_pipeline_artifact_id", unique: true
t.index ["retry_at"], name: "index_pipeline_artifact_registry_on_retry_at"
t.index ["state"], name: "index_pipeline_artifact_registry_on_state"
t.index ["verification_retry_at"], name: "pipeline_artifact_registry_failed_verification", order: "NULLS FIRST", where: "((state = 2) AND (verification_state = 3))"
t.index ["verification_state"], name: "pipeline_artifact_registry_needs_verification", where: "((state = 2) AND (verification_state = ANY (ARRAY[0, 3])))"
t.index ["verified_at"], name: "pipeline_artifact_registry_pending_verification", order: "NULLS FIRST", where: "((state = 2) AND (verification_state = 0))"
end
create_table "project_registry", id: :serial, force: :cascade do |t|
t.integer "project_id", null: false
t.datetime "last_repository_synced_at"
t.datetime "last_repository_successful_sync_at"
t.datetime "created_at", null: false
t.boolean "resync_repository", default: true, null: false
t.boolean "resync_wiki", default: true, null: false
t.datetime "last_wiki_synced_at"
t.datetime "last_wiki_successful_sync_at"
t.integer "repository_retry_count"
t.datetime "repository_retry_at"
t.boolean "force_to_redownload_repository"
t.integer "wiki_retry_count"
t.datetime "wiki_retry_at"
t.boolean "force_to_redownload_wiki"
t.string "last_repository_sync_failure"
t.string "last_wiki_sync_failure"
t.string "last_repository_verification_failure"
t.string "last_wiki_verification_failure"
t.binary "repository_verification_checksum_sha"
t.binary "wiki_verification_checksum_sha"
t.boolean "repository_checksum_mismatch", default: false, null: false
t.boolean "wiki_checksum_mismatch", default: false, null: false
t.boolean "last_repository_check_failed"
t.datetime_with_timezone "last_repository_check_at"
t.datetime_with_timezone "resync_repository_was_scheduled_at"
t.datetime_with_timezone "resync_wiki_was_scheduled_at"
t.boolean "repository_missing_on_primary"
t.boolean "wiki_missing_on_primary"
t.integer "repository_verification_retry_count"
t.integer "wiki_verification_retry_count"
t.datetime_with_timezone "last_repository_verification_ran_at"
t.datetime_with_timezone "last_wiki_verification_ran_at"
t.binary "repository_verification_checksum_mismatched"
t.binary "wiki_verification_checksum_mismatched"
t.boolean "primary_repository_checksummed", default: false, null: false
t.boolean "primary_wiki_checksummed", default: false, null: false
t.index ["last_repository_successful_sync_at"], name: "idx_project_registry_synced_repositories_partial", where: "((resync_repository = false) AND (repository_retry_count IS NULL) AND (repository_verification_checksum_sha IS NOT NULL))"
t.index ["last_repository_successful_sync_at"], name: "index_project_registry_on_last_repository_successful_sync_at"
t.index ["last_repository_synced_at"], name: "index_project_registry_on_last_repository_synced_at"
t.index ["project_id"], name: "idx_project_registry_on_repo_checksums_and_failure_partial", where: "((repository_verification_checksum_sha IS NULL) AND (last_repository_verification_failure IS NULL))"
t.index ["project_id"], name: "idx_project_registry_on_repository_failure_partial", where: "(last_repository_verification_failure IS NOT NULL)"
t.index ["project_id"], name: "idx_project_registry_on_wiki_checksums_and_failure_partial", where: "((wiki_verification_checksum_sha IS NULL) AND (last_wiki_verification_failure IS NULL))"
t.index ["project_id"], name: "idx_project_registry_on_wiki_failure_partial", where: "(last_wiki_verification_failure IS NOT NULL)"
t.index ["project_id"], name: "idx_repository_checksum_mismatch", where: "(repository_checksum_mismatch = true)"
t.index ["project_id"], name: "idx_wiki_checksum_mismatch", where: "(wiki_checksum_mismatch = true)"
t.index ["project_id"], name: "index_project_registry_on_project_id", unique: true
t.index ["repository_retry_at"], name: "index_project_registry_on_repository_retry_at"
t.index ["repository_retry_count"], name: "idx_project_registry_failed_repositories_partial", where: "((repository_retry_count > 0) OR (last_repository_verification_failure IS NOT NULL) OR repository_checksum_mismatch)"
t.index ["repository_retry_count"], name: "idx_project_registry_pending_repositories_partial", where: "((repository_retry_count IS NULL) AND (last_repository_successful_sync_at IS NOT NULL) AND ((resync_repository = true) OR ((repository_verification_checksum_sha IS NULL) AND (last_repository_verification_failure IS NULL))))"
t.index ["repository_verification_checksum_sha"], name: "idx_project_registry_on_repository_checksum_sha_partial", where: "(repository_verification_checksum_sha IS NULL)"
t.index ["resync_repository"], name: "index_project_registry_on_resync_repository"
t.index ["resync_wiki"], name: "index_project_registry_on_resync_wiki"
t.index ["wiki_retry_at"], name: "index_project_registry_on_wiki_retry_at"
t.index ["wiki_verification_checksum_sha"], name: "idx_project_registry_on_wiki_checksum_sha_partial", where: "(wiki_verification_checksum_sha IS NULL)"
end
create_table "secondary_usage_data", force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
t.jsonb "payload", default: {}, null: false
end
create_table "snippet_repository_registry", force: :cascade do |t|
t.datetime_with_timezone "retry_at"
t.datetime_with_timezone "last_synced_at"
t.datetime_with_timezone "created_at", null: false
t.bigint "snippet_repository_id", null: false
t.integer "state", limit: 2, default: 0, null: false
t.integer "retry_count", limit: 2, default: 0
t.text "last_sync_failure"
t.boolean "force_to_redownload"
t.boolean "missing_on_primary"
t.datetime_with_timezone "verification_started_at"
t.datetime_with_timezone "verified_at"
t.datetime_with_timezone "verification_retry_at"
t.integer "verification_retry_count"
t.integer "verification_state", limit: 2, default: 0, null: false
t.boolean "checksum_mismatch"
t.binary "verification_checksum"
t.binary "verification_checksum_mismatched"
t.string "verification_failure", limit: 255
t.index ["retry_at"], name: "index_snippet_repository_registry_on_retry_at"
t.index ["snippet_repository_id"], name: "index_snippet_repository_registry_on_snippet_repository_id", unique: true
t.index ["state"], name: "index_snippet_repository_registry_on_state"
t.index ["verification_retry_at"], name: "snippet_repository_registry_failed_verification", order: "NULLS FIRST", where: "((state = 2) AND (verification_state = 3))"
t.index ["verification_state"], name: "snippet_repository_registry_needs_verification", where: "((state = 2) AND (verification_state = ANY (ARRAY[0, 3])))"
t.index ["verified_at"], name: "snippet_repository_registry_pending_verification", order: "NULLS FIRST", where: "((state = 2) AND (verification_state = 0))"
end
create_table "terraform_state_version_registry", force: :cascade do |t|
t.bigint "terraform_state_version_id", null: false
t.integer "state", limit: 2, default: 0, null: false
t.integer "retry_count", limit: 2, default: 0, null: false
t.datetime_with_timezone "retry_at"
t.datetime_with_timezone "last_synced_at"
t.datetime_with_timezone "created_at", null: false
t.text "last_sync_failure"
t.datetime_with_timezone "verification_started_at"
t.datetime_with_timezone "verified_at"
t.datetime_with_timezone "verification_retry_at"
t.integer "verification_retry_count", default: 0
t.integer "verification_state", limit: 2, default: 0, null: false
t.boolean "checksum_mismatch", default: false, null: false
t.binary "verification_checksum"
t.binary "verification_checksum_mismatched"
t.string "verification_failure", limit: 255
t.index ["retry_at"], name: "index_terraform_state_version_registry_on_retry_at"
t.index ["state"], name: "index_terraform_state_version_registry_on_state"
t.index ["terraform_state_version_id"], name: "index_terraform_state_version_registry_on_t_state_version_id", unique: true
t.index ["terraform_state_version_id"], name: "index_tf_state_versions_registry_tf_state_versions_id_unique", unique: true
t.index ["verification_retry_at"], name: "terraform_state_version_registry_failed_verification", order: "NULLS FIRST", where: "((state = 2) AND (verification_state = 3))"
t.index ["verification_state"], name: "terraform_state_version_registry_needs_verification", where: "((state = 2) AND (verification_state = ANY (ARRAY[0, 3])))"
t.index ["verified_at"], name: "terraform_state_version_registry_pending_verification", order: "NULLS FIRST", where: "((state = 2) AND (verification_state = 0))"
end
end
raise 'ee/db/geo/schema.rb should not be used anymore, use ee/db/geo/structure.sql instead'
fc56ad577659aeb35893c644f404cbe226ef5c4b64d46bd7a6979917170e8379
\ No newline at end of file
03f26e06b4a8ba1d7f4793ed59f2790bc782de059a377777adeaa05645d940bc
\ No newline at end of file
1ee3e2ecb36df2c136430b7a302121cb8b916b54966a1d9c53fb959058b1101c
\ No newline at end of file
ffdbcf4ba41532961d8245078c5c80997fc8a7494181e9aae22d8d8eb0d84fae
\ No newline at end of file
6ce74aada3515fe681d55c19f3b483d44dae6878bfdc8713377a0eece3591701
\ No newline at end of file
7585f2682dc0b35f3bc5e105bd338ce3602cec7e6301a1a59c3b8342e6dd10bd
\ No newline at end of file
3d715f80eeda6d29cb4bfb725dca4303160d6be515371015726d86d4cfc92b58
\ No newline at end of file
ddcfa3398a102a01eda15bb3fa0b6a796011186084b291efd3a0766d327cd22e
\ No newline at end of file
158f354fa311961e328951fc365c8d0a87e6c55fbc8bd477b623006abaf18dfe
\ No newline at end of file
44f717e6b7bd87909ea978cdd74991babd0dd3a8e44dbfa4a6b7ec0874dfeeff
\ No newline at end of file
89faad46515d44af495b75b7c6ebcdc2c282fbb965cf5f6b34c4df534378b4c5
\ No newline at end of file
cb9da5bc60b2d4699c9117e3e384575e393d0c98b6f669606d98781d22dbc3ac
\ No newline at end of file
a6cc590283c5160a325ddd66a8139ac9da973670a5e1ec6c13772535da973237
\ No newline at end of file
b44a91c540b476b9c63ba247ef9f0e3ee2b696737cc3a59f1b60436dd0d8107f
\ No newline at end of file
2fb6f33c9d2942d0c83f550963447e414616ded09718e59b9e657480aa8cdfd5
\ No newline at end of file
871f226decc06e96cfb5f8156c7e87accc9475e22cd97d6c41fa27c8eb5855b7
\ No newline at end of file
427f9c742870563003a6f7728b8523faed8ad061b00fc01d307d4f2df83867c1
\ No newline at end of file
86fd97eff85491d242c8d38acadd383be052175d9e0dcfcecb32aeb152183c34
\ No newline at end of file
842585c0203ead10143bba55cb34d2ab360831661db4519f9083306cde9041f0
\ No newline at end of file
df6168850c19c25ac7a177cf91bc5c8ee73fca93724f171d427bf9937e9a6a6c
\ No newline at end of file
c818e0fc91534f407567d6ee1f9e5cd858392c7afbd22c35463c617ec57296f0
\ No newline at end of file
dc1fbc3291af7c261d686747d0985fee6fdc65cce98f262eca496af087020a8c
\ No newline at end of file
701f46d9972f184c27e2e8bc3631296138b522035ff35624db9688de9ae3d34b
\ No newline at end of file
322e4466d309ccfd8f24064c7835d9b271268d290e8204af06587fa2f5313272
\ No newline at end of file
72c5a2f8a94566a34fcc3df16b72a4239a37a9b1098ce31284d42bd5fefa52c0
\ No newline at end of file
43b9134bcd2c244859497764ae902da51e69320827301be4033b358cd2be3cfe
\ No newline at end of file
646959b39da5bb35f03941af129444c4364218ecc72ba9ffcfb869fa1d83e030
\ No newline at end of file
497de32713debe7016d643f0d9a1eafd6d4dd982c6f56374e26fc91647a61c64
\ No newline at end of file
6616c486d58e39cc4452f4d28a9f47e5c376ee5e6e9450d9659412467569e9b3
\ No newline at end of file
07196b409c0c9e73e4707a8137716f025f09238869e1b319efa045a0a8a97f74
\ No newline at end of file
8c8454796921d35b59261c9d3a9a29d5c3b52dd85a0171a36b81c0316563d984
\ No newline at end of file
f555f44342f489f4633fde2961c98c857ba9d673b4bde78b278d8a112858fe3d
\ No newline at end of file
01b19219e46985ac5dc1df2e6afb45fb9d006f082fadf1565eb4ac9206afb01a
\ No newline at end of file
853357855ebdc76d39a991b402764bc8009f47473f6f03e74c6ec26602695442
\ No newline at end of file
b035dbc1bafa92ab1595cb416314f23052b09fac4aff7d8e0556cdae752300fa
\ No newline at end of file
dc5fe525d8ebb0088f4b704b01b4568e2d8cb487156b4bbc6c90c16d53c501fc
\ No newline at end of file
a4a38efe967d1bf4a9b29e1545e32b3ea59d3373920b0989f65ccd1e79b79543
\ No newline at end of file
79c814920903ea9b92a2540dc9078a2b119ed63cbe02756d16f2c482ca1889ec
\ No newline at end of file
309fceeed92c7454495742644158f9cd2c31d75fc489cffdf18992c69f9b10c7
\ No newline at end of file
9c00de916aaa87b205fede9ae8c4decc03a1987fd038cd888abc905556da6334
\ No newline at end of file
67b34fe78c0d2f25fde2d7a981bc2de1053d46dad9d911df16d238ea02749197
\ No newline at end of file
805651c9c9f4fcc7ee69be2a774334bd3dea59475f9234da01b8ddc2badb7fb3
\ No newline at end of file
5766c582effb731ce3346ccf335eba9350d671b41ab9697c0c81ce901065f33e
\ No newline at end of file
a6804d3592cfde2b9541a1cfa20fb67762fa82cf9ebc3f703a98668f742995b0
\ No newline at end of file
15e06328a76772499ce08936d7e11e272ca57c3a5e04246a9b2ddab5e651d0c4
\ No newline at end of file
e1a58a3bc183214d280b253d0171cb97fca3c065a67a746214cf5d096acf0834
\ No newline at end of file
d7c8a2d1a8a4f36781a56475f8d96e830a33a7e94cfe4f622f28c6c43b76323d
\ No newline at end of file
2a6439cf81ef55b063b277112847b436f7daf37f1fc1d3e76261dc49e8ddba9b
\ No newline at end of file
4fbed5a9d9fb34137db151b78efdc9cf7ffbeb445728a1dbf536f1f8d621f066
\ No newline at end of file
2447efe0b351ce5f18aca8c9193541bbd83cdc8a6d009306b57c4158d80525b8
\ No newline at end of file
91b9f4eece930583053a215792537f8288e8d7226d1cb619eff167999d2c63d9
\ No newline at end of file
73adf0b2df8b314fa4911087d54649e2b2d83310516dd1b7557f8195875744d6
\ No newline at end of file
7dc9e31a729e11dfc4888d681f21b4260d4345d63ec2142aa3e78889d4c60c87
\ No newline at end of file
b99486cc34650ba7f735f04813cfcb3af24f8cebe8b293d4ef8db7f08b99fb04
\ No newline at end of file
e0c194fd28eb186918b71e5d90517cab6bc63d6ae0bdce69ea3bf3e89596e124
\ No newline at end of file
7b11f57bd5e4e96676c78335096b2e12b83fdfbc7b7df04fa18fb5b64ce963d1
\ No newline at end of file
faf6f0c60a3a0151995bf0d7973820de649aad4e6d708575e9ae79317ad893eb
\ No newline at end of file
7123ecf2a4b6cd114173126eb9375f050a1bc9b17df4a434f03b42ff902fe407
\ No newline at end of file
f9e1bca1a7a0c6642359689fa3340313d1d3fdadf31c338c971cb9313cf2b983
\ No newline at end of file
84bd01454296401f86c1866a33c6b45091333c6b3d638f5384b9c474bd7ab290
\ No newline at end of file
27d0aa487d569f90cf5f408fca0040b4bd679394520f41c602c2179891ffbb3b
\ No newline at end of file
0f364cf251d7fcda281145d84dda51cd67d33e4dfe87a805b3b188227c0dddbd
\ No newline at end of file
2b4bb29e09a1cc599c7b6e2b455bd6ea3175f3b7470ff8cbfef8be686dfb2abc
\ No newline at end of file
11f9ae81865a4315d6b46d90c1636252333747c095de567a056ebb344bc0e702
\ No newline at end of file
392afdcfb817a88a3cd35afa4db87749bc70418913dd90dbca616c06cdb24b1d
\ No newline at end of file
d009ec5b2c7ec6b1f54969dc182c47400e0a6a14f77174852ea42bc5c7823a27
\ No newline at end of file
b63d6fbfdcf0caf5399cb0c7579831d9187a18de88c7e516a84d21625e5fc963
\ No newline at end of file
823dc59c6b24cfd1784d1dd45e26f8e365e2e812001aa94b9a59daa1e1999f16
\ No newline at end of file
10bbe723769c6bf30f11406eb7f336f55b5b7b0e805c2fdeb24b018895315fd6
\ No newline at end of file
88a3355eb13da8ebccffeef580371a9ed6913baa0755ec4fe84a477eb02de432
\ No newline at end of file
710ade13436e31c2d8170d85e8890475db8f07fd60c2b89a14ef8824be005bc2
\ No newline at end of file
4cb0e40afc41a81af078e1afc53773fcee508bd4c4d6447ec432d8a28f743177
\ No newline at end of file
2af1ff7554c41a412ee92bea810127c5f38485a49e93c7da021b2590544e5150
\ No newline at end of file
ce8b83b1233035e24a58a79755fc062bc699f1b5337dfc74de0666a968ac484d
\ No newline at end of file
7376c4a2de86ac8879209571757319c9dc1c1b08292f55b904b4e60041d91e56
\ No newline at end of file
6c974f3987f274ec7cd5ce2225a7cc4170c87a487c981c65b94df4c3a7bd25c9
\ No newline at end of file
08472c4eefc6f596e2e705c62ea3aedc3c2db40ad8c6e169f597da6504ddfaa1
\ No newline at end of file
c57c851e7a2c7f393ae93df48cda9021b49cfb4bc75093462fd49f6502d02175
\ No newline at end of file
CREATE TABLE ar_internal_metadata (
key character varying NOT NULL,
value character varying,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
CREATE TABLE container_repository_registry (
id integer NOT NULL,
container_repository_id integer NOT NULL,
state character varying,
retry_count integer DEFAULT 0,
last_sync_failure character varying,
retry_at timestamp without time zone,
last_synced_at timestamp without time zone,
created_at timestamp without time zone NOT NULL
);
CREATE SEQUENCE container_repository_registry_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE container_repository_registry_id_seq OWNED BY container_repository_registry.id;
CREATE TABLE design_registry (
id integer NOT NULL,
project_id integer NOT NULL,
state character varying(20),
retry_count integer DEFAULT 0,
last_sync_failure character varying,
force_to_redownload boolean,
missing_on_primary boolean,
retry_at timestamp without time zone,
last_synced_at timestamp without time zone,
created_at timestamp without time zone NOT NULL
);
CREATE SEQUENCE design_registry_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE design_registry_id_seq OWNED BY design_registry.id;
CREATE TABLE event_log_states (
event_id bigint NOT NULL,
created_at timestamp without time zone NOT NULL
);
CREATE SEQUENCE event_log_states_event_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE event_log_states_event_id_seq OWNED BY event_log_states.event_id;
CREATE TABLE file_registry (
id integer NOT NULL,
file_type character varying NOT NULL,
file_id integer NOT NULL,
bytes bigint,
sha256 character varying,
created_at timestamp without time zone NOT NULL,
success boolean DEFAULT false NOT NULL,
retry_count integer DEFAULT 0,
retry_at timestamp without time zone,
missing_on_primary boolean DEFAULT false NOT NULL,
state smallint DEFAULT 0 NOT NULL,
last_synced_at timestamp with time zone,
last_sync_failure character varying(255)
);
CREATE SEQUENCE file_registry_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE file_registry_id_seq OWNED BY file_registry.id;
CREATE TABLE group_wiki_repository_registry (
id bigint NOT NULL,
retry_at timestamp with time zone,
last_synced_at timestamp with time zone,
created_at timestamp with time zone NOT NULL,
group_wiki_repository_id bigint NOT NULL,
state smallint DEFAULT 0 NOT NULL,
retry_count smallint DEFAULT 0,
last_sync_failure text,
force_to_redownload boolean,
missing_on_primary boolean
);
CREATE SEQUENCE group_wiki_repository_registry_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE group_wiki_repository_registry_id_seq OWNED BY group_wiki_repository_registry.id;
CREATE TABLE job_artifact_registry (
id integer NOT NULL,
created_at timestamp with time zone,
retry_at timestamp with time zone,
bytes bigint,
artifact_id integer,
retry_count integer,
success boolean,
sha256 character varying,
missing_on_primary boolean DEFAULT false NOT NULL
);
CREATE SEQUENCE job_artifact_registry_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE job_artifact_registry_id_seq OWNED BY job_artifact_registry.id;
CREATE TABLE lfs_object_registry (
id bigint NOT NULL,
created_at timestamp with time zone,
retry_at timestamp with time zone,
bytes bigint,
lfs_object_id integer,
retry_count integer DEFAULT 0,
missing_on_primary boolean DEFAULT false NOT NULL,
success boolean DEFAULT false NOT NULL,
sha256 bytea,
state smallint DEFAULT 0 NOT NULL,
last_synced_at timestamp with time zone,
last_sync_failure text
);
CREATE SEQUENCE lfs_object_registry_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE lfs_object_registry_id_seq OWNED BY lfs_object_registry.id;
CREATE TABLE merge_request_diff_registry (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
retry_at timestamp with time zone,
last_synced_at timestamp with time zone,
merge_request_diff_id bigint NOT NULL,
state smallint DEFAULT 0 NOT NULL,
retry_count smallint DEFAULT 0,
last_sync_failure text,
verification_started_at timestamp with time zone,
verified_at timestamp with time zone,
verification_retry_at timestamp with time zone,
verification_retry_count integer,
verification_state smallint DEFAULT 0 NOT NULL,
checksum_mismatch boolean,
verification_checksum bytea,
verification_checksum_mismatched bytea,
verification_failure character varying(255)
);
CREATE SEQUENCE merge_request_diff_registry_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE merge_request_diff_registry_id_seq OWNED BY merge_request_diff_registry.id;
CREATE TABLE package_file_registry (
id integer NOT NULL,
package_file_id integer NOT NULL,
state integer DEFAULT 0 NOT NULL,
retry_count integer DEFAULT 0,
last_sync_failure character varying(255),
retry_at timestamp with time zone,
last_synced_at timestamp with time zone,
created_at timestamp with time zone NOT NULL,
verification_failure character varying(255),
verification_checksum bytea,
checksum_mismatch boolean,
verification_checksum_mismatched bytea,
verification_retry_count integer,
verified_at timestamp with time zone,
verification_retry_at timestamp with time zone,
verification_state smallint DEFAULT 0 NOT NULL,
verification_started_at timestamp with time zone
);
CREATE SEQUENCE package_file_registry_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE package_file_registry_id_seq OWNED BY package_file_registry.id;
CREATE TABLE pages_deployment_registry (
id bigint NOT NULL,
pages_deployment_id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
last_synced_at timestamp with time zone,
retry_at timestamp with time zone,
state smallint DEFAULT 0 NOT NULL,
retry_count smallint DEFAULT 0 NOT NULL,
last_sync_failure character varying(255)
);
CREATE SEQUENCE pages_deployment_registry_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE pages_deployment_registry_id_seq OWNED BY pages_deployment_registry.id;
CREATE TABLE pipeline_artifact_registry (
id bigint NOT NULL,
pipeline_artifact_id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
last_synced_at timestamp with time zone,
retry_at timestamp with time zone,
verified_at timestamp with time zone,
verification_started_at timestamp with time zone,
verification_retry_at timestamp with time zone,
state smallint DEFAULT 0 NOT NULL,
verification_state smallint DEFAULT 0 NOT NULL,
retry_count smallint DEFAULT 0,
verification_retry_count smallint DEFAULT 0,
checksum_mismatch boolean DEFAULT false NOT NULL,
verification_checksum bytea,
verification_checksum_mismatched bytea,
verification_failure character varying(255),
last_sync_failure character varying(255)
);
CREATE SEQUENCE pipeline_artifact_registry_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE pipeline_artifact_registry_id_seq OWNED BY pipeline_artifact_registry.id;
CREATE TABLE project_registry (
id integer NOT NULL,
project_id integer NOT NULL,
last_repository_synced_at timestamp without time zone,
last_repository_successful_sync_at timestamp without time zone,
created_at timestamp without time zone NOT NULL,
resync_repository boolean DEFAULT true NOT NULL,
resync_wiki boolean DEFAULT true NOT NULL,
last_wiki_synced_at timestamp without time zone,
last_wiki_successful_sync_at timestamp without time zone,
repository_retry_count integer,
repository_retry_at timestamp without time zone,
force_to_redownload_repository boolean,
wiki_retry_count integer,
wiki_retry_at timestamp without time zone,
force_to_redownload_wiki boolean,
last_repository_sync_failure character varying,
last_wiki_sync_failure character varying,
last_repository_verification_failure character varying,
last_wiki_verification_failure character varying,
repository_verification_checksum_sha bytea,
wiki_verification_checksum_sha bytea,
repository_checksum_mismatch boolean DEFAULT false NOT NULL,
wiki_checksum_mismatch boolean DEFAULT false NOT NULL,
last_repository_check_failed boolean,
last_repository_check_at timestamp with time zone,
resync_repository_was_scheduled_at timestamp with time zone,
resync_wiki_was_scheduled_at timestamp with time zone,
repository_missing_on_primary boolean,
wiki_missing_on_primary boolean,
repository_verification_retry_count integer,
wiki_verification_retry_count integer,
last_repository_verification_ran_at timestamp with time zone,
last_wiki_verification_ran_at timestamp with time zone,
repository_verification_checksum_mismatched bytea,
wiki_verification_checksum_mismatched bytea,
primary_repository_checksummed boolean DEFAULT false NOT NULL,
primary_wiki_checksummed boolean DEFAULT false NOT NULL
);
CREATE SEQUENCE project_registry_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE project_registry_id_seq OWNED BY project_registry.id;
CREATE TABLE schema_migrations (
version character varying NOT NULL
);
CREATE TABLE secondary_usage_data (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL,
payload jsonb DEFAULT '{}'::jsonb NOT NULL
);
CREATE SEQUENCE secondary_usage_data_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE secondary_usage_data_id_seq OWNED BY secondary_usage_data.id;
CREATE TABLE snippet_repository_registry (
id bigint NOT NULL,
retry_at timestamp with time zone,
last_synced_at timestamp with time zone,
created_at timestamp with time zone NOT NULL,
snippet_repository_id bigint NOT NULL,
state smallint DEFAULT 0 NOT NULL,
retry_count smallint DEFAULT 0,
last_sync_failure text,
force_to_redownload boolean,
missing_on_primary boolean,
verification_started_at timestamp with time zone,
verified_at timestamp with time zone,
verification_retry_at timestamp with time zone,
verification_retry_count integer,
verification_state smallint DEFAULT 0 NOT NULL,
checksum_mismatch boolean,
verification_checksum bytea,
verification_checksum_mismatched bytea,
verification_failure character varying(255)
);
CREATE SEQUENCE snippet_repository_registry_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE snippet_repository_registry_id_seq OWNED BY snippet_repository_registry.id;
CREATE TABLE terraform_state_version_registry (
id bigint NOT NULL,
terraform_state_version_id bigint NOT NULL,
state smallint DEFAULT 0 NOT NULL,
retry_count smallint DEFAULT 0 NOT NULL,
retry_at timestamp with time zone,
last_synced_at timestamp with time zone,
created_at timestamp with time zone NOT NULL,
last_sync_failure text,
verification_started_at timestamp with time zone,
verified_at timestamp with time zone,
verification_retry_at timestamp with time zone,
verification_retry_count integer DEFAULT 0,
verification_state smallint DEFAULT 0 NOT NULL,
checksum_mismatch boolean DEFAULT false NOT NULL,
verification_checksum bytea,
verification_checksum_mismatched bytea,
verification_failure character varying(255)
);
CREATE SEQUENCE terraform_state_version_registry_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE terraform_state_version_registry_id_seq OWNED BY terraform_state_version_registry.id;
ALTER TABLE ONLY container_repository_registry ALTER COLUMN id SET DEFAULT nextval('container_repository_registry_id_seq'::regclass);
ALTER TABLE ONLY design_registry ALTER COLUMN id SET DEFAULT nextval('design_registry_id_seq'::regclass);
ALTER TABLE ONLY event_log_states ALTER COLUMN event_id SET DEFAULT nextval('event_log_states_event_id_seq'::regclass);
ALTER TABLE ONLY file_registry ALTER COLUMN id SET DEFAULT nextval('file_registry_id_seq'::regclass);
ALTER TABLE ONLY group_wiki_repository_registry ALTER COLUMN id SET DEFAULT nextval('group_wiki_repository_registry_id_seq'::regclass);
ALTER TABLE ONLY job_artifact_registry ALTER COLUMN id SET DEFAULT nextval('job_artifact_registry_id_seq'::regclass);
ALTER TABLE ONLY lfs_object_registry ALTER COLUMN id SET DEFAULT nextval('lfs_object_registry_id_seq'::regclass);
ALTER TABLE ONLY merge_request_diff_registry ALTER COLUMN id SET DEFAULT nextval('merge_request_diff_registry_id_seq'::regclass);
ALTER TABLE ONLY package_file_registry ALTER COLUMN id SET DEFAULT nextval('package_file_registry_id_seq'::regclass);
ALTER TABLE ONLY pages_deployment_registry ALTER COLUMN id SET DEFAULT nextval('pages_deployment_registry_id_seq'::regclass);
ALTER TABLE ONLY pipeline_artifact_registry ALTER COLUMN id SET DEFAULT nextval('pipeline_artifact_registry_id_seq'::regclass);
ALTER TABLE ONLY project_registry ALTER COLUMN id SET DEFAULT nextval('project_registry_id_seq'::regclass);
ALTER TABLE ONLY secondary_usage_data ALTER COLUMN id SET DEFAULT nextval('secondary_usage_data_id_seq'::regclass);
ALTER TABLE ONLY snippet_repository_registry ALTER COLUMN id SET DEFAULT nextval('snippet_repository_registry_id_seq'::regclass);
ALTER TABLE ONLY terraform_state_version_registry ALTER COLUMN id SET DEFAULT nextval('terraform_state_version_registry_id_seq'::regclass);
ALTER TABLE ONLY ar_internal_metadata
ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
ALTER TABLE ONLY container_repository_registry
ADD CONSTRAINT container_repository_registry_pkey PRIMARY KEY (id);
ALTER TABLE ONLY design_registry
ADD CONSTRAINT design_registry_pkey PRIMARY KEY (id);
ALTER TABLE ONLY event_log_states
ADD CONSTRAINT event_log_states_pkey PRIMARY KEY (event_id);
ALTER TABLE ONLY file_registry
ADD CONSTRAINT file_registry_pkey PRIMARY KEY (id);
ALTER TABLE ONLY group_wiki_repository_registry
ADD CONSTRAINT group_wiki_repository_registry_pkey PRIMARY KEY (id);
ALTER TABLE ONLY job_artifact_registry
ADD CONSTRAINT job_artifact_registry_pkey PRIMARY KEY (id);
ALTER TABLE ONLY lfs_object_registry
ADD CONSTRAINT lfs_object_registry_pkey PRIMARY KEY (id);
ALTER TABLE ONLY merge_request_diff_registry
ADD CONSTRAINT merge_request_diff_registry_pkey PRIMARY KEY (id);
ALTER TABLE ONLY package_file_registry
ADD CONSTRAINT package_file_registry_pkey PRIMARY KEY (id);
ALTER TABLE ONLY pages_deployment_registry
ADD CONSTRAINT pages_deployment_registry_pkey PRIMARY KEY (id);
ALTER TABLE ONLY pipeline_artifact_registry
ADD CONSTRAINT pipeline_artifact_registry_pkey PRIMARY KEY (id);
ALTER TABLE ONLY project_registry
ADD CONSTRAINT project_registry_pkey PRIMARY KEY (id);
ALTER TABLE ONLY schema_migrations
ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
ALTER TABLE ONLY secondary_usage_data
ADD CONSTRAINT secondary_usage_data_pkey PRIMARY KEY (id);
ALTER TABLE ONLY snippet_repository_registry
ADD CONSTRAINT snippet_repository_registry_pkey PRIMARY KEY (id);
ALTER TABLE ONLY terraform_state_version_registry
ADD CONSTRAINT terraform_state_version_registry_pkey PRIMARY KEY (id);
CREATE INDEX idx_project_registry_failed_repositories_partial ON project_registry USING btree (repository_retry_count) WHERE ((repository_retry_count > 0) OR (last_repository_verification_failure IS NOT NULL) OR repository_checksum_mismatch);
CREATE INDEX idx_project_registry_on_repo_checksums_and_failure_partial ON project_registry USING btree (project_id) WHERE ((repository_verification_checksum_sha IS NULL) AND (last_repository_verification_failure IS NULL));
CREATE INDEX idx_project_registry_on_repository_checksum_sha_partial ON project_registry USING btree (repository_verification_checksum_sha) WHERE (repository_verification_checksum_sha IS NULL);
CREATE INDEX idx_project_registry_on_repository_failure_partial ON project_registry USING btree (project_id) WHERE (last_repository_verification_failure IS NOT NULL);
CREATE INDEX idx_project_registry_on_wiki_checksum_sha_partial ON project_registry USING btree (wiki_verification_checksum_sha) WHERE (wiki_verification_checksum_sha IS NULL);
CREATE INDEX idx_project_registry_on_wiki_checksums_and_failure_partial ON project_registry USING btree (project_id) WHERE ((wiki_verification_checksum_sha IS NULL) AND (last_wiki_verification_failure IS NULL));
CREATE INDEX idx_project_registry_on_wiki_failure_partial ON project_registry USING btree (project_id) WHERE (last_wiki_verification_failure IS NOT NULL);
CREATE INDEX idx_project_registry_pending_repositories_partial ON project_registry USING btree (repository_retry_count) WHERE ((repository_retry_count IS NULL) AND (last_repository_successful_sync_at IS NOT NULL) AND ((resync_repository = true) OR ((repository_verification_checksum_sha IS NULL) AND (last_repository_verification_failure IS NULL))));
CREATE INDEX idx_project_registry_synced_repositories_partial ON project_registry USING btree (last_repository_successful_sync_at) WHERE ((resync_repository = false) AND (repository_retry_count IS NULL) AND (repository_verification_checksum_sha IS NOT NULL));
CREATE INDEX idx_repository_checksum_mismatch ON project_registry USING btree (project_id) WHERE (repository_checksum_mismatch = true);
CREATE INDEX idx_wiki_checksum_mismatch ON project_registry USING btree (project_id) WHERE (wiki_checksum_mismatch = true);
CREATE INDEX index_container_repository_registry_on_retry_at ON container_repository_registry USING btree (retry_at);
CREATE INDEX index_container_repository_registry_on_state ON container_repository_registry USING btree (state);
CREATE UNIQUE INDEX index_container_repository_registry_repository_id_unique ON container_repository_registry USING btree (container_repository_id);
CREATE UNIQUE INDEX index_design_registry_on_project_id ON design_registry USING btree (project_id);
CREATE INDEX index_design_registry_on_retry_at ON design_registry USING btree (retry_at);
CREATE INDEX index_design_registry_on_state ON design_registry USING btree (state);
CREATE INDEX index_file_registry_on_file_type ON file_registry USING btree (file_type);
CREATE UNIQUE INDEX index_file_registry_on_file_type_and_file_id ON file_registry USING btree (file_type, file_id);
CREATE INDEX index_file_registry_on_retry_at ON file_registry USING btree (retry_at);
CREATE INDEX index_file_registry_on_success ON file_registry USING btree (success);
CREATE UNIQUE INDEX index_g_wiki_repository_registry_on_group_wiki_repository_id ON group_wiki_repository_registry USING btree (group_wiki_repository_id);
CREATE INDEX index_group_wiki_repository_registry_on_retry_at ON group_wiki_repository_registry USING btree (retry_at);
CREATE INDEX index_group_wiki_repository_registry_on_state ON group_wiki_repository_registry USING btree (state);
CREATE INDEX index_job_artifact_registry_on_artifact_id ON job_artifact_registry USING btree (artifact_id);
CREATE INDEX index_job_artifact_registry_on_retry_at ON job_artifact_registry USING btree (retry_at);
CREATE INDEX index_job_artifact_registry_on_success ON job_artifact_registry USING btree (success);
CREATE UNIQUE INDEX index_lfs_object_registry_on_lfs_object_id ON lfs_object_registry USING btree (lfs_object_id);
CREATE INDEX index_lfs_object_registry_on_retry_at ON lfs_object_registry USING btree (retry_at);
CREATE INDEX index_lfs_object_registry_on_success ON lfs_object_registry USING btree (success);
CREATE UNIQUE INDEX index_merge_request_diff_registry_on_mr_diff_id ON merge_request_diff_registry USING btree (merge_request_diff_id);
CREATE INDEX index_merge_request_diff_registry_on_retry_at ON merge_request_diff_registry USING btree (retry_at);
CREATE INDEX index_merge_request_diff_registry_on_state ON merge_request_diff_registry USING btree (state);
CREATE INDEX index_package_file_registry_on_repository_id ON package_file_registry USING btree (package_file_id);
CREATE INDEX index_package_file_registry_on_retry_at ON package_file_registry USING btree (retry_at);
CREATE INDEX index_package_file_registry_on_state ON package_file_registry USING btree (state);
CREATE UNIQUE INDEX index_pages_deployment_registry_on_pages_deployment_id ON pages_deployment_registry USING btree (pages_deployment_id);
CREATE INDEX index_pages_deployment_registry_on_retry_at ON pages_deployment_registry USING btree (retry_at);
CREATE INDEX index_pages_deployment_registry_on_state ON pages_deployment_registry USING btree (state);
CREATE UNIQUE INDEX index_pipeline_artifact_registry_on_pipeline_artifact_id ON pipeline_artifact_registry USING btree (pipeline_artifact_id);
CREATE INDEX index_pipeline_artifact_registry_on_retry_at ON pipeline_artifact_registry USING btree (retry_at);
CREATE INDEX index_pipeline_artifact_registry_on_state ON pipeline_artifact_registry USING btree (state);
CREATE INDEX index_project_registry_on_last_repository_successful_sync_at ON project_registry USING btree (last_repository_successful_sync_at);
CREATE INDEX index_project_registry_on_last_repository_synced_at ON project_registry USING btree (last_repository_synced_at);
CREATE UNIQUE INDEX index_project_registry_on_project_id ON project_registry USING btree (project_id);
CREATE INDEX index_project_registry_on_repository_retry_at ON project_registry USING btree (repository_retry_at);
CREATE INDEX index_project_registry_on_resync_repository ON project_registry USING btree (resync_repository);
CREATE INDEX index_project_registry_on_resync_wiki ON project_registry USING btree (resync_wiki);
CREATE INDEX index_project_registry_on_wiki_retry_at ON project_registry USING btree (wiki_retry_at);
CREATE INDEX index_snippet_repository_registry_on_retry_at ON snippet_repository_registry USING btree (retry_at);
CREATE UNIQUE INDEX index_snippet_repository_registry_on_snippet_repository_id ON snippet_repository_registry USING btree (snippet_repository_id);
CREATE INDEX index_snippet_repository_registry_on_state ON snippet_repository_registry USING btree (state);
CREATE INDEX index_state_in_lfs_objects ON lfs_object_registry USING btree (state);
CREATE INDEX index_terraform_state_version_registry_on_retry_at ON terraform_state_version_registry USING btree (retry_at);
CREATE INDEX index_terraform_state_version_registry_on_state ON terraform_state_version_registry USING btree (state);
CREATE UNIQUE INDEX index_terraform_state_version_registry_on_t_state_version_id ON terraform_state_version_registry USING btree (terraform_state_version_id);
CREATE UNIQUE INDEX index_tf_state_versions_registry_tf_state_versions_id_unique ON terraform_state_version_registry USING btree (terraform_state_version_id);
CREATE INDEX merge_request_diff_registry_failed_verification ON merge_request_diff_registry USING btree (verification_retry_at NULLS FIRST) WHERE ((state = 2) AND (verification_state = 3));
CREATE INDEX merge_request_diff_registry_needs_verification ON merge_request_diff_registry USING btree (verification_state) WHERE ((state = 2) AND (verification_state = ANY (ARRAY[0, 3])));
CREATE INDEX merge_request_diff_registry_pending_verification ON merge_request_diff_registry USING btree (verified_at NULLS FIRST) WHERE ((state = 2) AND (verification_state = 0));
CREATE INDEX package_file_registry_failed_verification ON package_file_registry USING btree (verification_retry_at NULLS FIRST) WHERE ((state = 2) AND (verification_state = 3));
CREATE INDEX package_file_registry_needs_verification ON package_file_registry USING btree (verification_state) WHERE ((state = 2) AND (verification_state = ANY (ARRAY[0, 3])));
CREATE INDEX package_file_registry_pending_verification ON package_file_registry USING btree (verified_at NULLS FIRST) WHERE ((state = 2) AND (verification_state = 0));
CREATE INDEX pipeline_artifact_registry_failed_verification ON pipeline_artifact_registry USING btree (verification_retry_at NULLS FIRST) WHERE ((state = 2) AND (verification_state = 3));
CREATE INDEX pipeline_artifact_registry_needs_verification ON pipeline_artifact_registry USING btree (verification_state) WHERE ((state = 2) AND (verification_state = ANY (ARRAY[0, 3])));
CREATE INDEX pipeline_artifact_registry_pending_verification ON pipeline_artifact_registry USING btree (verified_at NULLS FIRST) WHERE ((state = 2) AND (verification_state = 0));
CREATE INDEX snippet_repository_registry_failed_verification ON snippet_repository_registry USING btree (verification_retry_at NULLS FIRST) WHERE ((state = 2) AND (verification_state = 3));
CREATE INDEX snippet_repository_registry_needs_verification ON snippet_repository_registry USING btree (verification_state) WHERE ((state = 2) AND (verification_state = ANY (ARRAY[0, 3])));
CREATE INDEX snippet_repository_registry_pending_verification ON snippet_repository_registry USING btree (verified_at NULLS FIRST) WHERE ((state = 2) AND (verification_state = 0));
CREATE INDEX terraform_state_version_registry_failed_verification ON terraform_state_version_registry USING btree (verification_retry_at NULLS FIRST) WHERE ((state = 2) AND (verification_state = 3));
CREATE INDEX terraform_state_version_registry_needs_verification ON terraform_state_version_registry USING btree (verification_state) WHERE ((state = 2) AND (verification_state = ANY (ARRAY[0, 3])));
CREATE INDEX terraform_state_version_registry_pending_verification ON terraform_state_version_registry USING btree (verified_at NULLS FIRST) WHERE ((state = 2) AND (verification_state = 0));
......@@ -64,10 +64,7 @@ module Gitlab
require 'active_record/schema_dumper'
Gitlab::Geo::DatabaseTasks.with_geo_db do
filename = ENV['SCHEMA'] || File.join(ActiveRecord::Tasks::DatabaseTasks.db_dir, 'schema.rb')
File.open(filename, "w:utf-8") do |file|
ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)
end
ActiveRecord::Tasks::DatabaseTasks.dump_schema(Gitlab::Geo::DatabaseTasks.db_config)
end
end
end
......@@ -132,10 +129,10 @@ module Gitlab
Gitlab::Geo::DatabaseTasks.with_geo_db do
should_reconnect = ActiveRecord::Base.connection_pool.active_connection?
ActiveRecord::Schema.verbose = false
ActiveRecord::Tasks::DatabaseTasks.load_schema(ActiveRecord::Base.configurations.configs_for(env_name: 'test').first, :ruby, ENV['SCHEMA'])
ActiveRecord::Tasks::DatabaseTasks.load_schema(ActiveRecord::Base.configurations.configs_for(env_name: 'test').first, :sql, ENV['SCHEMA'])
ensure
if should_reconnect
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env).first)
ActiveRecord::Base.establish_connection(Gitlab::Geo::DatabaseTasks.db_config)
end
end
end
......@@ -152,6 +149,7 @@ module Gitlab
database_config: YAML.load_file(GEO_DATABASE_CONFIG),
db_dir: GEO_DB_DIR,
migrations_paths: geo_migrations_paths,
schema_migrations_path: geo_schema_migrations_path,
seed_loader: SeedLoader.new
}
end
......@@ -170,6 +168,10 @@ module Gitlab
Rails.root.join(GEO_DB_DIR, 'post_migrate')
end
def geo_schema_migrations_path
Rails.root.join(GEO_DB_DIR, 'schema_migrations').to_s
end
def with_geo_db
abort_if_no_geo_config!
......@@ -177,7 +179,8 @@ module Gitlab
database_config: ActiveRecord::Tasks::DatabaseTasks.database_configuration&.dup || YAML.load_file(DATABASE_CONFIG),
db_dir: ActiveRecord::Tasks::DatabaseTasks.db_dir,
migrations_paths: ActiveRecord::Tasks::DatabaseTasks.migrations_paths,
seed_loader: ActiveRecord::Tasks::DatabaseTasks.seed_loader
seed_loader: ActiveRecord::Tasks::DatabaseTasks.seed_loader,
schema_migrations_path: Gitlab::Database::SchemaMigrations::Context.default_schema_migrations_path
}
set_db_env(geo_settings)
......@@ -187,6 +190,10 @@ module Gitlab
set_db_env(original_settings)
end
def db_config
ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env).first
end
def set_db_env(settings)
ActiveRecord::Tasks::DatabaseTasks.database_configuration = settings[:database_config]
ActiveRecord::Tasks::DatabaseTasks.db_dir = settings[:db_dir]
......@@ -195,8 +202,9 @@ module Gitlab
ActiveRecord::Base.configurations = ActiveRecord::Tasks::DatabaseTasks.database_configuration || {}
ActiveRecord::Migrator.migrations_paths = ActiveRecord::Tasks::DatabaseTasks.migrations_paths
Gitlab::Database::SchemaMigrations::Context.default_schema_migrations_path = settings[:schema_migrations_path]
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env).first)
ActiveRecord::Base.establish_connection(db_config)
end
class SeedLoader
......
......@@ -38,7 +38,7 @@ namespace :geo do
puts "Current version: #{Gitlab::Geo::DatabaseTasks.version}"
end
desc 'GitLab | Geo | DB | Drops and recreates the database from ee/db/geo/schema.rb for the current environment and loads the seeds.'
desc 'GitLab | Geo | DB | Drops and recreates the database from ee/db/geo/structure.sql for the current environment and loads the seeds.'
task reset: [:environment] do
ns['drop'].invoke
ns['create'].invoke
......@@ -77,12 +77,12 @@ namespace :geo do
end
namespace :schema do
desc 'GitLab | Geo | DB | Schema | Load a schema.rb file into the database'
desc 'GitLab | Geo | DB | Schema | Load a structure.sql file into the database'
task load: [:environment] do
Gitlab::Geo::DatabaseTasks.load_schema_current(:ruby, ENV['SCHEMA'])
Gitlab::Geo::DatabaseTasks.load_schema_current(ActiveRecord::Base.schema_format, ENV['SCHEMA'])
end
desc 'GitLab | Geo | DB | Schema | Create a ee/db/geo/schema.rb file that is portable against any DB supported by AR'
desc 'GitLab | Geo | DB | Schema | Create a ee/db/geo/structure.sql file that is portable against any DB supported by AR'
task dump: [:environment] do
Gitlab::Geo::DatabaseTasks::Schema.dump
......@@ -90,6 +90,13 @@ namespace :geo do
end
end
# Inform Rake that custom tasks should be run every time rake db:schema:dump is run
Rake::Task['geo:db:schema:dump'].enhance do
Gitlab::Geo::DatabaseTasks.with_geo_db do
Rake::Task['gitlab:db:clean_structure_sql'].invoke
end
end
namespace :migrate do
desc 'GitLab | Geo | DB | Migrate | Runs the "up" for a given migration VERSION.'
task up: [:environment] do
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe Gitlab::Geo::DatabaseTasks, :reestablished_active_record_base do
let(:schema_file) { Rails.root.join('tmp', 'tests', 'geo_schema.rb').to_s }
let(:schema_file) { Rails.root.join('tmp', 'tests', 'geo_structure.sql').to_s }
subject { described_class }
......@@ -59,8 +59,8 @@ RSpec.describe Gitlab::Geo::DatabaseTasks, :reestablished_active_record_base do
describe described_class::Schema do
describe '.dump' do
it 'calls ActiveRecord::SchemaDumper.dump' do
expect(ActiveRecord::SchemaDumper).to receive(:dump)
it 'calls ActiveRecord::Tasks::DatabaseTasks.dump_schema' do
expect(ActiveRecord::Tasks::DatabaseTasks).to receive(:dump_schema)
subject.dump
end
......
......@@ -6,7 +6,13 @@ RSpec.describe 'geo rake tasks', :geo, :silence_stdout do
include ::EE::GeoHelpers
before do
Rake.application.rake_require 'active_record/railties/databases'
Rake.application.rake_require 'tasks/gitlab/db'
Rake.application.rake_require 'tasks/geo'
# empty task as env is already loaded
Rake::Task.define_task :environment
stub_licensed_features(geo: true)
end
......@@ -133,15 +139,16 @@ RSpec.describe 'geo rake tasks', :geo, :silence_stdout do
describe 'geo:db:schema_load' do
it 'loads schema file into database' do
allow(ENV).to receive(:[]).with('SCHEMA')
expect(Gitlab::Geo::DatabaseTasks).to receive(:load_schema_current).with(:ruby, ENV['SCHEMA'])
expect(Gitlab::Geo::DatabaseTasks).to receive(:load_schema_current).with(:sql, ENV['SCHEMA'])
run_rake_task('geo:db:schema:load')
end
end
describe 'geo:db:schema_dump' do
it 'creates schema.rb file' do
it 'creates a clean structure.sql file', :reestablished_active_record_base do
expect(Gitlab::Geo::DatabaseTasks::Schema).to receive(:dump)
expect(Rake::Task['gitlab:db:clean_structure_sql']).to receive(:invoke)
run_rake_task('geo:db:schema:dump')
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