diff options
author | Francisco Javier López <fjlopez@gitlab.com> | 2017-12-07 11:44:55 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-12-07 11:44:55 +0300 |
commit | c9871e84e4b605922689aee5957d206516dca8e8 (patch) | |
tree | 6b4818c767b6e87cbe21f4808411f00db0d593d6 /db | |
parent | af09fb858e0588d4d246ffa55bdd653e05d97b63 (diff) |
The API isn't using the appropriate services for managing forks
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20171205190711_reschedule_fork_network_creation_caller.rb | 27 | ||||
-rw-r--r-- | db/schema.rb | 2 |
2 files changed, 28 insertions, 1 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 new file mode 100644 index 00000000000..30ff5173192 --- /dev/null +++ b/db/post_migrate/20171205190711_reschedule_fork_network_creation_caller.rb @@ -0,0 +1,27 @@ +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 + include EachBatch + + self.table_name = 'forked_project_links' + end + + def 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 + # nothing + end +end diff --git a/db/schema.rb b/db/schema.rb index 2be1b745342..6ea3ab54742 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: 20171124150326) do +ActiveRecord::Schema.define(version: 20171205190711) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" |