Skip to content

Renames fk_rails_f601258b28 FK to fk_rails_0434b48643 on events table

What does this MR do and why?

Renames fk_rails_f601258b28 to fk_rails_0434b48643.

It solves this inconsistency between db/structure.sql and production DB.

In production DB:

"fk_rails_f601258b28" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE

In structure.sql:

"fk_rails_0434b48643" FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE

bundle exec rails db:migrate

Local DB
main: == 20230302191635 RenameConstraintFkRailsF601258b28OnEvents: migrating ========
main: == 20230302191635 RenameConstraintFkRailsF601258b28OnEvents: migrated (0.1049s)

ci: == 20230302191635 RenameConstraintFkRailsF601258b28OnEvents: migrating ========
ci: == 20230302191635 RenameConstraintFkRailsF601258b28OnEvents: migrated (0.0514s)
Production DB clone
main: == 20230302191635 RenameConstraintFkRailsF601258b28OnEvents: migrating ========
main: -- quote_table_name(:events)
main:    -> 0.0000s
main: -- quote_column_name(:fk_rails_f601258b28)
main:    -> 0.0000s
main: -- quote_column_name(:fk_rails_0434b48643)
main:    -> 0.0000s
main: -- execute("ALTER TABLE \"events\"\nRENAME CONSTRAINT \"fk_rails_f601258b28\" TO \"fk_rails_0434b48643\"\n")
main:    -> 0.2035s
main: == 20230302191635 RenameConstraintFkRailsF601258b28OnEvents: migrated (1.5402s)

ci: == 20230302191635 RenameConstraintFkRailsF601258b28OnEvents: migrating ========
ci: -- quote_table_name(:events)
ci:    -> 0.0001s
ci: -- quote_column_name(:fk_rails_f601258b28)
ci:    -> 0.0000s
ci: -- quote_column_name(:fk_rails_0434b48643)
ci:    -> 0.0000s
ci: -- execute("ALTER TABLE \"events\"\nRENAME CONSTRAINT \"fk_rails_f601258b28\" TO \"fk_rails_0434b48643\"\n")
ci:    -> 0.1964s
ci: == 20230302191635 RenameConstraintFkRailsF601258b28OnEvents: migrated (1.3778s)

bundle exec rails db:rollback

Local DB
main: == 20230302191635 RenameConstraintFkRailsF601258b28OnEvents: reverting ========
main: == 20230302191635 RenameConstraintFkRailsF601258b28OnEvents: reverted (0.0040s)

ci: == 20230302191635 RenameConstraintFkRailsF601258b28OnEvents: reverting ========
ci: == 20230302191635 RenameConstraintFkRailsF601258b28OnEvents: reverted (0.0357s)
Production DB clone
main: == 20230302191635 RenameConstraintFkRailsF601258b28OnEvents: reverting ========
main: == 20230302191635 RenameConstraintFkRailsF601258b28OnEvents: reverted (2.5624s)

ci: == 20230302191635 RenameConstraintFkRailsF601258b28OnEvents: reverting ========
ci: == 20230302191635 RenameConstraintFkRailsF601258b28OnEvents: reverted (0.7803s)

Screenshots or screen recordings

How to set up and validate locally

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #346750 (closed)

Edited by Leonardo da Rosa

Merge request reports

Loading