Skip to content

Drop time_format_in_24h column

Arturo Herrero requested to merge drop-time-format-in-24h-column into master

Description

After ignoring the time_format_in_24h column in %16.0 !119025 (merged), we can now drop it in %16.1.

Migration output

Up

$ rake db:migrate
main: == [advisory_lock_connection] object_id: 275960, pg_backend_pid: 98039
main: == 20230518121320 RemoveTimeFormatIn24hColumn: migrating ======================
main: -- remove_column(:user_preferences, :time_format_in_24h)
main:    -> 0.0018s
main: == 20230518121320 RemoveTimeFormatIn24hColumn: migrated (0.0055s) =============

main: == [advisory_lock_connection] object_id: 275960, pg_backend_pid: 98039
ci: == [advisory_lock_connection] object_id: 276260, pg_backend_pid: 98042
ci: == 20230518121320 RemoveTimeFormatIn24hColumn: migrating ======================
ci: -- remove_column(:user_preferences, :time_format_in_24h)
ci:    -> 0.0008s
ci: == 20230518121320 RemoveTimeFormatIn24hColumn: migrated (0.0089s) =============

ci: == [advisory_lock_connection] object_id: 276260, pg_backend_pid: 98042

Down

$ rake db:migrate:down:main db:migrate:down:ci VERSION=20230518121320
main: == [advisory_lock_connection] object_id: 275740, pg_backend_pid: 5545
main: == 20230518121320 RemoveTimeFormatIn24hColumn: reverting ======================
main: -- add_column(:user_preferences, :time_format_in_24h, :boolean)
main:    -> 0.0022s
main: == 20230518121320 RemoveTimeFormatIn24hColumn: reverted (0.0060s) =============

main: == [advisory_lock_connection] object_id: 275740, pg_backend_pid: 5545
ci: == [advisory_lock_connection] object_id: 276620, pg_backend_pid: 5808
ci: == 20230518121320 RemoveTimeFormatIn24hColumn: reverting ======================
ci: -- add_column(:user_preferences, :time_format_in_24h, :boolean)
ci:    -> 0.0019s
ci: == 20230518121320 RemoveTimeFormatIn24hColumn: reverted (0.0159s) =============

ci: == [advisory_lock_connection] object_id: 276620, pg_backend_pid: 5808

Reference: https://docs.gitlab.com/ee/development/database/avoiding_downtime_in_migrations.html#dropping-columns

Related to #29669 (closed).

Merge request reports

Loading