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
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: 130980, pg_backend_pid: 29370
main: == 20250103105345 CreateWorkItemUserPreferences: migrating ====================
main: -- create_table(:work_item_user_preferences)
main: -- quote_column_name(:sort)
main: -> 0.0000s
main: -> 0.0059s
main: == 20250103105345 CreateWorkItemUserPreferences: migrated (0.0269s) ===========
main: == [advisory_lock_connection] object_id: 130980, pg_backend_pid: 29370
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: 130980, pg_backend_pid: 29761
ci: == [advisory_lock_connection] object_id: 130980, pg_backend_pid: 29761
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: 130980, pg_backend_pid: 30154
main: == 20250103105346 AddForeignKeysToWorkItemUserPreferences: migrating ==========
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- execute("ALTER TABLE work_item_user_preferences ADD CONSTRAINT fk_9a643e31b2 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE NOT VALID;")
main: -> 0.0020s
main: -- execute("SET statement_timeout TO 0")
main: -> 0.0007s
main: -- execute("ALTER TABLE work_item_user_preferences VALIDATE CONSTRAINT fk_9a643e31b2;")
main: -> 0.0038s
main: -- execute("RESET statement_timeout")
main: -> 0.0007s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main: -> 0.0005s
main: -- index_exists?(:work_item_user_preferences, :user_id, {:algorithm=>:concurrently})
main: -> 0.0019s
main: -- add_index(:work_item_user_preferences, :user_id, {:algorithm=>:concurrently})
main: -> 0.0021s
main: -- index_name(:work_item_user_preferences, :user_id)
main: -> 0.0000s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- execute("ALTER TABLE work_item_user_preferences ADD CONSTRAINT fk_d2c7f09192 FOREIGN KEY (namespace_id) REFERENCES namespaces (id) ON DELETE CASCADE NOT VALID;")
main: -> 0.0012s
main: -- execute("ALTER TABLE work_item_user_preferences VALIDATE CONSTRAINT fk_d2c7f09192;")
main: -> 0.0021s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main: -> 0.0005s
main: -- index_exists?(:work_item_user_preferences, :namespace_id, {:algorithm=>:concurrently})
main: -> 0.0019s
main: -- add_index(:work_item_user_preferences, :namespace_id, {:algorithm=>:concurrently})
main: -> 0.0015s
main: -- index_name(:work_item_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_user_preferences ADD CONSTRAINT fk_350210c5da FOREIGN KEY (work_item_type_id) REFERENCES work_item_types (id) ON DELETE CASCADE NOT VALID;")
main: -> 0.0007s
main: -- execute("ALTER TABLE work_item_user_preferences VALIDATE CONSTRAINT fk_350210c5da;")
main: -> 0.0019s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main: -> 0.0005s
main: -- index_exists?(:work_item_user_preferences, :work_item_type_id, {:algorithm=>:concurrently})
main: -> 0.0027s
main: -- add_index(:work_item_user_preferences, :work_item_type_id, {:algorithm=>:concurrently})
main: -> 0.0015s
main: -- index_name(:work_item_user_preferences, :work_item_type_id)
main: -> 0.0000s
main: == 20250103105346 AddForeignKeysToWorkItemUserPreferences: migrated (0.1295s) =
main: == [advisory_lock_connection] object_id: 130980, pg_backend_pid: 30154
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: 130980, pg_backend_pid: 30549
ci: == [advisory_lock_connection] object_id: 130980, pg_backend_pid: 30549
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.