From 235b105c917c16ab14a79ba13280aff4fd9f1cf9 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Wed, 30 Aug 2017 15:38:16 +0200 Subject: Finish migration to the new events setup This finishes the procedure for migrating events from the old format into the new format. Code no longer uses the old setup and the database tables used during the migration process are swapped, with the old table being dropped. While the database migration can be reversed this will 1) take a lot of time as data has to be coped around 2) won't restore data in the "events.data" column as we have no way of restoring this. Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/37241 --- db/schema.rb | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) (limited to 'db/schema.rb') diff --git a/db/schema.rb b/db/schema.rb index f980667a38f..5a0729ccfea 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -531,25 +531,6 @@ ActiveRecord::Schema.define(version: 20170901071411) do add_index "environments", ["project_id", "slug"], name: "index_environments_on_project_id_and_slug", unique: true, using: :btree create_table "events", force: :cascade do |t| - t.string "target_type" - t.integer "target_id" - t.string "title" - t.text "data" - t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "action" - t.integer "author_id" - end - - add_index "events", ["action"], name: "index_events_on_action", using: :btree - add_index "events", ["author_id"], name: "index_events_on_author_id", using: :btree - add_index "events", ["created_at"], name: "index_events_on_created_at", using: :btree - add_index "events", ["project_id", "id"], name: "index_events_on_project_id_and_id", using: :btree - add_index "events", ["target_id"], name: "index_events_on_target_id", using: :btree - add_index "events", ["target_type"], name: "index_events_on_target_type", using: :btree - - create_table "events_for_migration", force: :cascade do |t| t.integer "project_id" t.integer "author_id", null: false t.integer "target_id" @@ -559,10 +540,10 @@ ActiveRecord::Schema.define(version: 20170901071411) do t.string "target_type" end - add_index "events_for_migration", ["action"], name: "index_events_for_migration_on_action", using: :btree - add_index "events_for_migration", ["author_id"], name: "index_events_for_migration_on_author_id", using: :btree - add_index "events_for_migration", ["project_id", "id"], name: "index_events_for_migration_on_project_id_and_id", using: :btree - add_index "events_for_migration", ["target_type", "target_id"], name: "index_events_for_migration_on_target_type_and_target_id", using: :btree + add_index "events", ["action"], name: "index_events_on_action", using: :btree + add_index "events", ["author_id"], name: "index_events_on_author_id", using: :btree + add_index "events", ["project_id", "id"], name: "index_events_on_project_id_and_id", using: :btree + add_index "events", ["target_type", "target_id"], name: "index_events_on_target_type_and_target_id", using: :btree create_table "feature_gates", force: :cascade do |t| t.string "feature_key", null: false @@ -1697,9 +1678,8 @@ ActiveRecord::Schema.define(version: 20170901071411) do add_foreign_key "deploy_keys_projects", "projects", name: "fk_58a901ca7e", on_delete: :cascade add_foreign_key "deployments", "projects", name: "fk_b9a3851b82", on_delete: :cascade add_foreign_key "environments", "projects", name: "fk_d1c8c1da6a", on_delete: :cascade - add_foreign_key "events", "projects", name: "fk_0434b48643", on_delete: :cascade - add_foreign_key "events_for_migration", "projects", on_delete: :cascade - add_foreign_key "events_for_migration", "users", column: "author_id", name: "fk_edfd187b6f", on_delete: :cascade + add_foreign_key "events", "projects", on_delete: :cascade + add_foreign_key "events", "users", column: "author_id", name: "fk_edfd187b6f", on_delete: :cascade add_foreign_key "forked_project_links", "projects", column: "forked_to_project_id", name: "fk_434510edb0", on_delete: :cascade add_foreign_key "gpg_keys", "users", on_delete: :cascade add_foreign_key "gpg_signatures", "gpg_keys", on_delete: :nullify @@ -1743,7 +1723,7 @@ ActiveRecord::Schema.define(version: 20170901071411) do add_foreign_key "protected_tag_create_access_levels", "protected_tags", name: "fk_f7dfda8c51", on_delete: :cascade add_foreign_key "protected_tag_create_access_levels", "users" add_foreign_key "protected_tags", "projects", name: "fk_8e4af87648", on_delete: :cascade - add_foreign_key "push_event_payloads", "events_for_migration", column: "event_id", name: "fk_36c74129da", on_delete: :cascade + add_foreign_key "push_event_payloads", "events", name: "fk_36c74129da", on_delete: :cascade add_foreign_key "releases", "projects", name: "fk_47fe2a0596", on_delete: :cascade add_foreign_key "services", "projects", name: "fk_71cce407f9", on_delete: :cascade add_foreign_key "snippets", "projects", name: "fk_be41fd4bb7", on_delete: :cascade -- cgit v1.2.3 From 8d1321d66977dc50577cf23f7cb0a6e9caa8283e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20D=C3=A1vila?= Date: Wed, 16 Aug 2017 19:03:48 -0500 Subject: Add theme_id column to users table --- db/schema.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'db/schema.rb') diff --git a/db/schema.rb b/db/schema.rb index 1c1a5e63bc4..937075c8a3c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1614,6 +1614,7 @@ ActiveRecord::Schema.define(version: 20170905112933) do t.boolean "notified_of_own_activity" t.string "preferred_language" t.string "rss_token" + t.integer "theme_id", limit: 2 end add_index "users", ["admin"], name: "index_users_on_admin", using: :btree -- cgit v1.2.3 From d931cac7a3df2c890f3bd7a98aaa59947f460e42 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 7 Sep 2017 14:11:49 +0300 Subject: Update schema.rb from db:migrate and fix invalid index check Signed-off-by: Dmitriy Zaporozhets --- db/schema.rb | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'db/schema.rb') diff --git a/db/schema.rb b/db/schema.rb index 40b84f2bddd..274a0e4458f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -32,8 +32,8 @@ ActiveRecord::Schema.define(version: 20170831195038) do t.text "description", null: false t.string "header_logo" t.string "logo" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false t.text "description_html" t.integer "cached_markdown_version" end @@ -101,6 +101,10 @@ ActiveRecord::Schema.define(version: 20170831195038) do t.text "help_page_text_html" t.text "shared_runners_text_html" t.text "after_sign_up_text_html" + t.integer "rsa_key_restriction", default: 0, null: false + t.integer "dsa_key_restriction", default: 0, null: false + t.integer "ecdsa_key_restriction", default: 0, null: false + t.integer "ed25519_key_restriction", default: 0, null: false t.boolean "housekeeping_enabled", default: true, null: false t.boolean "housekeeping_bitmaps_enabled", default: true, null: false t.integer "housekeeping_incremental_repack_period", default: 10, null: false @@ -125,14 +129,10 @@ ActiveRecord::Schema.define(version: 20170831195038) do t.boolean "prometheus_metrics_enabled", default: false, null: false t.boolean "help_page_hide_commercial_content", default: false t.string "help_page_support_url" - t.integer "performance_bar_allowed_group_id" t.boolean "password_authentication_enabled" - t.boolean "project_export_enabled", default: true, null: false + t.integer "performance_bar_allowed_group_id" t.boolean "hashed_storage_enabled", default: false, null: false - t.integer "rsa_key_restriction", default: 0, null: false - t.integer "dsa_key_restriction", default: 0, null: false - t.integer "ecdsa_key_restriction", default: 0, null: false - t.integer "ed25519_key_restriction", default: 0, null: false + t.boolean "project_export_enabled", default: true, null: false end create_table "audit_events", force: :cascade do |t| @@ -255,6 +255,7 @@ ActiveRecord::Schema.define(version: 20170831195038) do add_index "ci_builds", ["commit_id", "status", "type"], name: "index_ci_builds_on_commit_id_and_status_and_type", using: :btree add_index "ci_builds", ["commit_id", "type", "name", "ref"], name: "index_ci_builds_on_commit_id_and_type_and_name_and_ref", using: :btree add_index "ci_builds", ["commit_id", "type", "ref"], name: "index_ci_builds_on_commit_id_and_type_and_ref", using: :btree + add_index "ci_builds", ["id"], name: "index_for_ci_builds_retried_migration", where: "(retried IS NULL)", using: :btree, opclasses: {"id)"=>"WHERE"} add_index "ci_builds", ["project_id"], name: "index_ci_builds_on_project_id", using: :btree add_index "ci_builds", ["protected"], name: "index_ci_builds_on_protected", using: :btree add_index "ci_builds", ["runner_id"], name: "index_ci_builds_on_runner_id", using: :btree @@ -273,8 +274,8 @@ ActiveRecord::Schema.define(version: 20170831195038) do t.string "encrypted_value_iv" t.integer "group_id", null: false t.boolean "protected", default: false, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false end add_index "ci_group_variables", ["group_id", "key"], name: "index_ci_group_variables_on_group_id_and_key", unique: true, using: :btree @@ -286,8 +287,8 @@ ActiveRecord::Schema.define(version: 20170831195038) do t.string "encrypted_value_salt" t.string "encrypted_value_iv" t.integer "pipeline_schedule_id", null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime_with_timezone "created_at" + t.datetime_with_timezone "updated_at" end add_index "ci_pipeline_schedule_variables", ["pipeline_schedule_id", "key"], name: "index_ci_pipeline_schedule_variables_on_schedule_id_and_key", unique: true, using: :btree @@ -553,8 +554,8 @@ ActiveRecord::Schema.define(version: 20170831195038) do t.integer "project_id" t.integer "author_id", null: false t.integer "target_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false t.integer "action", limit: 2, null: false t.string "target_type" end @@ -592,8 +593,8 @@ ActiveRecord::Schema.define(version: 20170831195038) do add_index "forked_project_links", ["forked_to_project_id"], name: "index_forked_project_links_on_forked_to_project_id", unique: true, using: :btree create_table "gpg_keys", force: :cascade do |t| - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false t.integer "user_id" t.binary "primary_keyid" t.binary "fingerprint" @@ -605,8 +606,8 @@ ActiveRecord::Schema.define(version: 20170831195038) do add_index "gpg_keys", ["user_id"], name: "index_gpg_keys_on_user_id", using: :btree create_table "gpg_signatures", force: :cascade do |t| - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime_with_timezone "created_at", null: false + t.datetime_with_timezone "updated_at", null: false t.integer "project_id" t.integer "gpg_key_id" t.binary "commit_sha" @@ -804,8 +805,8 @@ ActiveRecord::Schema.define(version: 20170831195038) do add_index "members", ["user_id"], name: "index_members_on_user_id", using: :btree create_table "merge_request_diff_commits", id: false, force: :cascade do |t| - t.datetime "authored_date" - t.datetime "committed_date" + t.datetime_with_timezone "authored_date" + t.datetime_with_timezone "committed_date" t.integer "merge_request_diff_id", null: false t.integer "relative_order", null: false t.binary "sha", null: false @@ -1208,6 +1209,7 @@ ActiveRecord::Schema.define(version: 20170831195038) do t.string "repository_storage", default: "default", null: false t.boolean "request_access_enabled", default: false, null: false t.boolean "has_external_wiki" + t.string "ci_config_path" t.boolean "lfs_enabled" t.text "description_html" t.boolean "only_allow_merge_if_all_discussions_are_resolved" @@ -1215,9 +1217,8 @@ ActiveRecord::Schema.define(version: 20170831195038) do t.integer "auto_cancel_pending_pipelines", default: 1, null: false t.string "import_jid" t.integer "cached_markdown_version" - t.datetime "last_repository_updated_at" - t.string "ci_config_path" t.text "delete_error" + t.datetime "last_repository_updated_at" t.integer "storage_version", limit: 2 end -- cgit v1.2.3