diff options
Diffstat (limited to 'db/post_migrate/20210303064142_cleanup_gitlab_subscriptions_with_null_namespace_id.rb')
-rw-r--r-- | db/post_migrate/20210303064142_cleanup_gitlab_subscriptions_with_null_namespace_id.rb | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/db/post_migrate/20210303064142_cleanup_gitlab_subscriptions_with_null_namespace_id.rb b/db/post_migrate/20210303064142_cleanup_gitlab_subscriptions_with_null_namespace_id.rb deleted file mode 100644 index 2250d4c0c8a..00000000000 --- a/db/post_migrate/20210303064142_cleanup_gitlab_subscriptions_with_null_namespace_id.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -class CleanupGitlabSubscriptionsWithNullNamespaceId < ActiveRecord::Migration[6.0] - disable_ddl_transaction! - - class GitlabSubscription < ActiveRecord::Base - self.table_name = 'gitlab_subscriptions' - end - - def up - # As of today, there is 0 records whose namespace_id is null on GitLab.com. - # And we expect no such records on non GitLab.com instance. - # So this post-migration cleanup script is just for extra safe. - # - # This will be fast on GitLab.com, because: - # - gitlab_subscriptions.count=5021850 - # - namespace_id is indexed, so the query is pretty fast. Try on database-lab, this uses 5.931 ms - GitlabSubscription.where(namespace_id: nil).delete_all - end - - def down - # no-op : can't go back to `NULL` without first dropping the `NOT NULL` constraint - end -end |