Create work_item_user_preferences table
What does this MR do and why?
Create work_item_user_preferences table
With the goal to save user preferences by work_item type and namespace we're creating a new table to save the preferences, starting by work_item sorting preference.
Related to: #501712 (closed)
Changelog: added
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
Migration Queries
bundle exec rails db:migrate:up:main VERSION=20250103105345
DEPRECATION WARNING: Support for Rails versions < 7.1 is deprecated and will be removed from ViewComponent 4.0.0 (ViewComponent v4 will remove support for Rails versions < 7.1 no earlier than April 1, 2025) (called from <main> at /Users/kassioborges/src/gdk/gitlab/config/environment.rb:7)
main: == [advisory_lock_connection] object_id: 131040, pg_backend_pid: 91053
main: == 20250103105345 CreateWorkItemTypeUserPreferences: migrating ================
main: -- create_table(:work_item_type_user_preferences)
main: -- quote_column_name(:sort)
main: -> 0.0000s
main: -> 0.0093s
main: == 20250103105345 CreateWorkItemTypeUserPreferences: migrated (0.0399s) =======
main: == [advisory_lock_connection] object_id: 131040, pg_backend_pid: 91053
bundle exec rails db:migrate:up:ci VERSION=20250103105345
DEPRECATION WARNING: Support for Rails versions < 7.1 is deprecated and will be removed from ViewComponent 4.0.0 (ViewComponent v4 will remove support for Rails versions < 7.1 no earlier than April 1, 2025) (called from <main> at /Users/kassioborges/src/gdk/gitlab/config/environment.rb:7)
ci: == [advisory_lock_connection] object_id: 131040, pg_backend_pid: 91446
ci: == 20250103105345 CreateWorkItemTypeUserPreferences: migrating ================
ci: -- create_table(:work_item_type_user_preferences)
ci: -- quote_column_name(:sort)
ci: -> 0.0000s
ci: -> 0.0127s
I, [2025-01-10T16:28:46.032263 #91298] INFO -- : Database: 'ci', Table: 'work_item_type_user_preferences': Lock Writes
ci: == 20250103105345 CreateWorkItemTypeUserPreferences: migrated (0.0684s) =======
ci: == [advisory_lock_connection] object_id: 131040, pg_backend_pid: 91446
bundle exec rails db:migrate:up:main VERSION=20250103105346
DEPRECATION WARNING: Support for Rails versions < 7.1 is deprecated and will be removed from ViewComponent 4.0.0 (ViewComponent v4 will remove support for Rails versions < 7.1 no earlier than April 1, 2025) (called from <main> at /Users/kassioborges/src/gdk/gitlab/config/environment.rb:7)
main: == [advisory_lock_connection] object_id: 131040, pg_backend_pid: 91839
main: == 20250103105346 AddForeignKeysToWorkItemTypeUserPreferences: migrating ======
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- execute("ALTER TABLE work_item_type_user_preferences ADD CONSTRAINT fk_0748f95f41 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE NOT VALID;")
main: -> 0.0016s
main: -- execute("SET statement_timeout TO 0")
main: -> 0.0005s
main: -- execute("ALTER TABLE work_item_type_user_preferences VALIDATE CONSTRAINT fk_0748f95f41;")
main: -> 0.0061s
main: -- execute("RESET statement_timeout")
main: -> 0.0008s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main: -> 0.0008s
main: -- index_exists?(:work_item_type_user_preferences, :namespace_id, {:algorithm=>:concurrently})
main: -> 0.0029s
main: -- add_index(:work_item_type_user_preferences, :namespace_id, {:algorithm=>:concurrently})
main: -> 0.0026s
main: -- index_name(:work_item_type_user_preferences, :namespace_id)
main: -> 0.0000s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- execute("ALTER TABLE work_item_type_user_preferences ADD CONSTRAINT fk_2e37b4f066 FOREIGN KEY (namespace_id) REFERENCES namespaces (id) ON DELETE CASCADE NOT VALID;")
main: -> 0.0014s
main: -- execute("ALTER TABLE work_item_type_user_preferences VALIDATE CONSTRAINT fk_2e37b4f066;")
main: -> 0.0045s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main: -> 0.0006s
main: -- index_exists?(:work_item_type_user_preferences, :work_item_type_id, {:algorithm=>:concurrently})
main: -> 0.0018s
main: -- add_index(:work_item_type_user_preferences, :work_item_type_id, {:algorithm=>:concurrently})
main: -> 0.0016s
main: -- index_name(:work_item_type_user_preferences, :work_item_type_id)
main: -> 0.0000s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- execute("ALTER TABLE work_item_type_user_preferences ADD CONSTRAINT fk_79e0353950 FOREIGN KEY (work_item_type_id) REFERENCES work_item_types (correct_id) ON DELETE CASCADE NOT VALID;")
main: -> 0.0009s
main: -- execute("ALTER TABLE work_item_type_user_preferences VALIDATE CONSTRAINT fk_79e0353950;")
main: -> 0.0024s
main: == 20250103105346 AddForeignKeysToWorkItemTypeUserPreferences: migrated (0.1436s)
main: == [advisory_lock_connection] object_id: 131040, pg_backend_pid: 91839
bundle exec rails db:migrate:up:ci VERSION=20250103105346
DEPRECATION WARNING: Support for Rails versions < 7.1 is deprecated and will be removed from ViewComponent 4.0.0 (ViewComponent v4 will remove support for Rails versions < 7.1 no earlier than April 1, 2025) (called from <main> at /Users/kassioborges/src/gdk/gitlab/config/environment.rb:7)
ci: == [advisory_lock_connection] object_id: 131040, pg_backend_pid: 92226
ci: == 20250103105346 AddForeignKeysToWorkItemTypeUserPreferences: migrating ======
ci: -- transaction_open?(nil)
ci: -> 0.0000s
ci: -- transaction_open?(nil)
ci: -> 0.0000s
ci: -- execute("ALTER TABLE work_item_type_user_preferences ADD CONSTRAINT fk_0748f95f41 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE NOT VALID;")
ci: -> 0.0014s
ci: -- execute("SET statement_timeout TO 0")
ci: -> 0.0004s
ci: -- execute("ALTER TABLE work_item_type_user_preferences VALIDATE CONSTRAINT fk_0748f95f41;")
ci: -> 0.0058s
ci: -- execute("RESET statement_timeout")
ci: -> 0.0009s
ci: -- transaction_open?(nil)
ci: -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci: -> 0.0006s
ci: -- index_exists?(:work_item_type_user_preferences, :namespace_id, {:algorithm=>:concurrently})
ci: -> 0.0022s
ci: -- add_index(:work_item_type_user_preferences, :namespace_id, {:algorithm=>:concurrently})
ci: -> 0.0021s
ci: -- index_name(:work_item_type_user_preferences, :namespace_id)
ci: -> 0.0000s
ci: -- transaction_open?(nil)
ci: -> 0.0000s
ci: -- transaction_open?(nil)
ci: -> 0.0000s
ci: -- execute("ALTER TABLE work_item_type_user_preferences ADD CONSTRAINT fk_2e37b4f066 FOREIGN KEY (namespace_id) REFERENCES namespaces (id) ON DELETE CASCADE NOT VALID;")
ci: -> 0.0012s
ci: -- execute("ALTER TABLE work_item_type_user_preferences VALIDATE CONSTRAINT fk_2e37b4f066;")
ci: -> 0.0039s
ci: -- transaction_open?(nil)
ci: -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci: -> 0.0005s
ci: -- index_exists?(:work_item_type_user_preferences, :work_item_type_id, {:algorithm=>:concurrently})
ci: -> 0.0015s
ci: -- add_index(:work_item_type_user_preferences, :work_item_type_id, {:algorithm=>:concurrently})
ci: -> 0.0019s
ci: -- index_name(:work_item_type_user_preferences, :work_item_type_id)
ci: -> 0.0000s
ci: -- transaction_open?(nil)
ci: -> 0.0000s
ci: -- transaction_open?(nil)
ci: -> 0.0000s
ci: -- execute("ALTER TABLE work_item_type_user_preferences ADD CONSTRAINT fk_79e0353950 FOREIGN KEY (work_item_type_id) REFERENCES work_item_types (correct_id) ON DELETE CASCADE NOT VALID;")
ci: -> 0.0007s
ci: -- execute("ALTER TABLE work_item_type_user_preferences VALIDATE CONSTRAINT fk_79e0353950;")
ci: -> 0.0021s
ci: == 20250103105346 AddForeignKeysToWorkItemTypeUserPreferences: migrated (0.1393s)
ci: == [advisory_lock_connection] object_id: 131040, pg_backend_pid: 92226
bundle exec rails db:migrate:down:main VERSION=20250103105346
DEPRECATION WARNING: Support for Rails versions < 7.1 is deprecated and will be removed from ViewComponent 4.0.0 (ViewComponent v4 will remove support for Rails versions < 7.1 no earlier than April 1, 2025) (called from <main> at /Users/kassioborges/src/gdk/gitlab/config/environment.rb:7)
main: == [advisory_lock_connection] object_id: 131040, pg_backend_pid: 89419
main: == 20250103105346 AddForeignKeysToWorkItemTypeUserPreferences: reverting ======
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- remove_foreign_key(:work_item_type_user_preferences, :users, {:column=>:user_id})
main: -> 0.0032s
main: -- remove_foreign_key(:work_item_type_user_preferences, :namespaces, {:column=>:namespace_id})
main: -> 0.0025s
main: -- remove_foreign_key(:work_item_type_user_preferences, :work_item_types, {:column=>:work_item_type_id})
main: -> 0.0029s
main: == 20250103105346 AddForeignKeysToWorkItemTypeUserPreferences: reverted (0.0614s)
main: == [advisory_lock_connection] object_id: 131040, pg_backend_pid: 89419
bundle exec rails db:migrate:down:ci VERSION=20250103105346
DEPRECATION WARNING: Support for Rails versions < 7.1 is deprecated and will be removed from ViewComponent 4.0.0 (ViewComponent v4 will remove support for Rails versions < 7.1 no earlier than April 1, 2025) (called from <main> at /Users/kassioborges/src/gdk/gitlab/config/environment.rb:7)
ci: == [advisory_lock_connection] object_id: 131040, pg_backend_pid: 89833
ci: == 20250103105346 AddForeignKeysToWorkItemTypeUserPreferences: reverting ======
ci: -- transaction_open?(nil)
ci: -> 0.0000s
ci: -- remove_foreign_key(:work_item_type_user_preferences, :users, {:column=>:user_id})
ci: -> 0.0056s
ci: -- remove_foreign_key(:work_item_type_user_preferences, :namespaces, {:column=>:namespace_id})
ci: -> 0.0030s
ci: -- remove_foreign_key(:work_item_type_user_preferences, :work_item_types, {:column=>:work_item_type_id})
ci: -> 0.0034s
ci: == 20250103105346 AddForeignKeysToWorkItemTypeUserPreferences: reverted (0.1058s)
ci: == [advisory_lock_connection] object_id: 131040, pg_backend_pid: 89833
bundle exec rails db:migrate:down:main VERSION=20250103105345
DEPRECATION WARNING: Support for Rails versions < 7.1 is deprecated and will be removed from ViewComponent 4.0.0 (ViewComponent v4 will remove support for Rails versions < 7.1 no earlier than April 1, 2025) (called from <main> at /Users/kassioborges/src/gdk/gitlab/config/environment.rb:7)
main: == [advisory_lock_connection] object_id: 131040, pg_backend_pid: 90237
main: == 20250103105345 CreateWorkItemTypeUserPreferences: reverting ================
main: -- drop_table(:work_item_type_user_preferences)
main: -> 0.0050s
main: == 20250103105345 CreateWorkItemTypeUserPreferences: reverted (0.0119s) =======
main: == [advisory_lock_connection] object_id: 131040, pg_backend_pid: 90237
bundle exec rails db:migrate:down:ci VERSION=20250103105345
DEPRECATION WARNING: Support for Rails versions < 7.1 is deprecated and will be removed from ViewComponent 4.0.0 (ViewComponent v4 will remove support for Rails versions < 7.1 no earlier than April 1, 2025) (called from <main> at /Users/kassioborges/src/gdk/gitlab/config/environment.rb:7)
ci: == [advisory_lock_connection] object_id: 131040, pg_backend_pid: 90644
ci: == 20250103105345 CreateWorkItemTypeUserPreferences: reverting ================
ci: -- drop_table(:work_item_type_user_preferences)
ci: -> 0.0033s
ci: == 20250103105345 CreateWorkItemTypeUserPreferences: reverted (0.0163s) =======
ci: == [advisory_lock_connection] object_id: 131040, pg_backend_pid: 90644
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.