Drop unused push_rules.organization_id and is_sample columns
Summary
The push_rules table is now dedicated to project-level push rules; organization-level rules moved to organization_push_rules and group-level rules to group_push_rules (parent tracker: #499156). Two legacy columns remain: organization_id (bigint, nullable), which no runtime code reads and whose loose foreign key entry was removed in !252073 (merged), and is_sample (boolean, default false), which backed the legacy instance-level "sample" push rule now replaced by organization_push_rules. Both columns, their indexes, and the associated dead code (PushRule#global?/is_sample? and fallback logic in ee/app/models/push_rule.rb) should be removed once self-managed cleanup completes.
Scope
- Ignore both columns in the
PushRulemodel (ignore_columns) in release M, drop columns in release M+1 per the standard column-removal process (https://docs.gitlab.com/development/database/avoiding_downtime_in_migrations/#dropping-columns) - Drop
index_push_rules_on_organization_idandindex_push_rules_on_is_sample(post-deploy migrations) - Remove
belongs_to :organizationand thedef organizationoverride,global?/is_sample?logic, and theOrganizationPushRuleFinderfallback reads inee/app/models/push_rule.rb - Remove
:is_samplefromlib/gitlab/import_export/project/import_export.yml - Remove the
push_rules: %w[organization_id]entry fromignored_fk_columns_mapinspec/db/schema_spec.rb - Update
db/docs/push_rules.ymlif needed
Blocked by
- #607954 —
DeleteNullProjectIdPushRulesBBM must be finalized for self-managed (scheduled for 19.6, after required stop 19.5) - #607955 — NOT NULL constraint on
push_rules.project_idmust be validated for self-managed (scheduled for 19.6, after required stop 19.5)
Until both complete, legacy rows with organization_id set may still exist on self-managed instances.
Related
- Dropping
organization_idunblocks considering a unique index onpush_rules.project_id: #493391 - The
regexp_uses_re2column deprecation is tracked separately and is out of scope here: #553148 (closed)