diff options
author | Francisco Lopez <fjlopez@gitlab.com> | 2017-12-06 16:46:32 +0100 |
---|---|---|
committer | Francisco Lopez <fjlopez@gitlab.com> | 2017-12-06 16:46:32 +0100 |
commit | 758ee3862476d38721e4ef156a835f6418b0f82f (patch) | |
tree | c2a6b1ec6457a9f5d42a8b0c611ce990c5cfe50e | |
parent | 1498839ea12679919ce7f94307ad5d80d3db51ff (diff) | |
download | gitlab-ce-fj-40752-forks-api-not-using-services.tar.gz |
Copy pasting againfj-40752-forks-api-not-using-services
-rw-r--r-- | db/post_migrate/20171205190711_reschedule_fork_network_creation_caller.rb | 16 | ||||
-rw-r--r-- | db/schema.rb | 71 |
2 files changed, 47 insertions, 40 deletions
diff --git a/db/post_migrate/20171205190711_reschedule_fork_network_creation_caller.rb b/db/post_migrate/20171205190711_reschedule_fork_network_creation_caller.rb index 7b38d143435..30ff5173192 100644 --- a/db/post_migrate/20171205190711_reschedule_fork_network_creation_caller.rb +++ b/db/post_migrate/20171205190711_reschedule_fork_network_creation_caller.rb @@ -1,6 +1,12 @@ -require './db/post_migrate/20171124150326_reschedule_fork_network_creation.rb' - class RescheduleForkNetworkCreationCaller < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + MIGRATION = 'PopulateForkNetworksRange'.freeze + BATCH_SIZE = 100 + DELAY_INTERVAL = 15.seconds + disable_ddl_transaction! class ForkedProjectLink < ActiveRecord::Base @@ -10,10 +16,12 @@ class RescheduleForkNetworkCreationCaller < ActiveRecord::Migration end def up - RescheduleForkNetworkCreation.new.up + say 'Populating the `fork_networks` based on existing `forked_project_links`' + + queue_background_migration_jobs_by_range_at_intervals(ForkedProjectLink, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE) end def down - RescheduleForkNetworkCreation.new.down + # nothing end end diff --git a/db/schema.rb b/db/schema.rb index 68828616611..d2faa854c8a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -32,8 +32,8 @@ ActiveRecord::Schema.define(version: 20171205190711) 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 @@ -149,7 +149,7 @@ ActiveRecord::Schema.define(version: 20171205190711) do t.integer "throttle_authenticated_web_requests_per_period", default: 7200, null: false t.integer "throttle_authenticated_web_period_in_seconds", default: 3600, null: false t.boolean "password_authentication_enabled_for_web" - t.boolean "password_authentication_enabled_for_git", default: true, null: false + t.boolean "password_authentication_enabled_for_git", default: true t.integer "gitaly_timeout_default", default: 55, null: false t.integer "gitaly_timeout_medium", default: 30, null: false t.integer "gitaly_timeout_fast", default: 10, null: false @@ -235,8 +235,8 @@ ActiveRecord::Schema.define(version: 20171205190711) do create_table "ci_build_trace_sections", force: :cascade do |t| t.integer "project_id", null: false - t.datetime "date_start", null: false - t.datetime "date_end", null: false + t.datetime_with_timezone "date_start", null: false + t.datetime_with_timezone "date_end", null: false t.integer "byte_start", limit: 8, null: false t.integer "byte_end", limit: 8, null: false t.integer "build_id", null: false @@ -313,8 +313,8 @@ ActiveRecord::Schema.define(version: 20171205190711) 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 @@ -326,8 +326,8 @@ ActiveRecord::Schema.define(version: 20171205190711) 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 @@ -477,8 +477,8 @@ ActiveRecord::Schema.define(version: 20171205190711) do create_table "cluster_platforms_kubernetes", force: :cascade do |t| t.integer "cluster_id", 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 t.text "api_url" t.text "ca_cert" t.string "namespace" @@ -494,8 +494,8 @@ ActiveRecord::Schema.define(version: 20171205190711) do create_table "cluster_projects", force: :cascade do |t| t.integer "project_id", null: false t.integer "cluster_id", 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 "cluster_projects", ["cluster_id"], name: "index_cluster_projects_on_cluster_id", using: :btree @@ -505,8 +505,8 @@ ActiveRecord::Schema.define(version: 20171205190711) do t.integer "cluster_id", null: false t.integer "status" t.integer "num_nodes", 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 t.text "status_reason" t.string "gcp_project_id", null: false t.string "zone", null: false @@ -523,8 +523,8 @@ ActiveRecord::Schema.define(version: 20171205190711) do t.integer "user_id" t.integer "provider_type" t.integer "platform_type" - 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.boolean "enabled", default: true t.string "name", null: false t.string "environment_scope", default: "*", null: false @@ -535,8 +535,8 @@ ActiveRecord::Schema.define(version: 20171205190711) do create_table "clusters_applications_helm", force: :cascade do |t| t.integer "cluster_id", 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 t.integer "status", null: false t.string "version", null: false t.text "status_reason" @@ -544,8 +544,8 @@ ActiveRecord::Schema.define(version: 20171205190711) do create_table "clusters_applications_ingress", force: :cascade do |t| t.integer "cluster_id", 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 t.integer "status", null: false t.integer "ingress_type", null: false t.string "version", null: false @@ -659,8 +659,8 @@ ActiveRecord::Schema.define(version: 20171205190711) 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 @@ -719,8 +719,8 @@ ActiveRecord::Schema.define(version: 20171205190711) do t.integer "service_id" t.integer "status" t.integer "gcp_cluster_size", 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 t.boolean "enabled", default: true t.text "status_reason" t.string "project_namespace" @@ -753,8 +753,8 @@ ActiveRecord::Schema.define(version: 20171205190711) do add_index "gpg_key_subkeys", ["keyid"], name: "index_gpg_key_subkeys_on_keyid", 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" @@ -766,8 +766,8 @@ ActiveRecord::Schema.define(version: 20171205190711) 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" @@ -849,7 +849,7 @@ ActiveRecord::Schema.define(version: 20171205190711) do t.datetime "last_edited_at" t.integer "last_edited_by_id" t.boolean "discussion_locked" - t.datetime "closed_at" + t.datetime_with_timezone "closed_at" end add_index "issues", ["assignee_id"], name: "index_issues_on_assignee_id", using: :btree @@ -981,8 +981,8 @@ ActiveRecord::Schema.define(version: 20171205190711) 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 @@ -1308,8 +1308,8 @@ ActiveRecord::Schema.define(version: 20171205190711) do create_table "project_auto_devops", force: :cascade do |t| t.integer "project_id", 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 t.boolean "enabled" t.string "domain" end @@ -1671,7 +1671,7 @@ ActiveRecord::Schema.define(version: 20171205190711) do t.datetime "updated_at", null: false t.integer "issue_id" t.integer "merge_request_id" - t.datetime "spent_at" + t.datetime_with_timezone "spent_at" end add_index "timelogs", ["issue_id"], name: "index_timelogs_on_issue_id", using: :btree @@ -1929,7 +1929,6 @@ ActiveRecord::Schema.define(version: 20171205190711) do add_foreign_key "cluster_providers_gcp", "clusters", on_delete: :cascade add_foreign_key "clusters", "users", on_delete: :nullify add_foreign_key "clusters_applications_helm", "clusters", on_delete: :cascade - add_foreign_key "clusters_applications_ingress", "clusters", on_delete: :cascade add_foreign_key "container_repositories", "projects" add_foreign_key "deploy_keys_projects", "projects", name: "fk_58a901ca7e", on_delete: :cascade add_foreign_key "deployments", "projects", name: "fk_b9a3851b82", on_delete: :cascade |