From 49c74068ae7f0017ebeb8e7daa2c556fef3124e3 Mon Sep 17 00:00:00 2001 From: Mario de la Ossa Date: Sun, 6 Jan 2019 18:00:48 -0600 Subject: Save sorting preference for Issues/MRs in BE In order to let users' sorting preferences transfer between devices, we save the preference for issues and MRs (one preference for issues, one for MRs) in the backend inside the UserPreference object --- ...6234221_add_sorting_fields_to_user_preference.rb | 21 +++++++++++++++++++++ db/schema.rb | 2 ++ 2 files changed, 23 insertions(+) create mode 100644 db/migrate/20190116234221_add_sorting_fields_to_user_preference.rb (limited to 'db') diff --git a/db/migrate/20190116234221_add_sorting_fields_to_user_preference.rb b/db/migrate/20190116234221_add_sorting_fields_to_user_preference.rb new file mode 100644 index 00000000000..7bf581fe9b0 --- /dev/null +++ b/db/migrate/20190116234221_add_sorting_fields_to_user_preference.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddSortingFieldsToUserPreference < ActiveRecord::Migration[5.0] + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + def up + add_column :user_preferences, :issues_sort, :string + add_column :user_preferences, :merge_requests_sort, :string + end + + def down + remove_column :user_preferences, :issues_sort + remove_column :user_preferences, :merge_requests_sort + end +end diff --git a/db/schema.rb b/db/schema.rb index 859f007dbe1..7c1733becb9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2146,6 +2146,8 @@ ActiveRecord::Schema.define(version: 20190124200344) do t.integer "merge_request_notes_filter", limit: 2, default: 0, null: false t.datetime_with_timezone "created_at", null: false t.datetime_with_timezone "updated_at", null: false + t.string "issues_sort" + t.string "merge_requests_sort" t.index ["user_id"], name: "index_user_preferences_on_user_id", unique: true, using: :btree end -- cgit v1.2.1