diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20200311093210_create_user_highest_roles.rb | 25 | ||||
-rw-r--r-- | db/schema.rb | 7 |
2 files changed, 32 insertions, 0 deletions
diff --git a/db/migrate/20200311093210_create_user_highest_roles.rb b/db/migrate/20200311093210_create_user_highest_roles.rb new file mode 100644 index 00000000000..36007f196d1 --- /dev/null +++ b/db/migrate/20200311093210_create_user_highest_roles.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class CreateUserHighestRoles < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + create_table :user_highest_roles, id: false do |t| + t.datetime_with_timezone :updated_at, null: false + t.references :user, primary_key: true, default: nil, index: false, foreign_key: { on_delete: :cascade } + t.integer :highest_access_level + + t.index [:user_id, :highest_access_level] + end + end + end + + def down + with_lock_retries do + drop_table :user_highest_roles + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 4e885ce7dc2..8aad65e9b35 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -4251,6 +4251,12 @@ ActiveRecord::Schema.define(version: 2020_03_11_165635) do t.index ["user_id"], name: "index_user_details_on_user_id", unique: true end + create_table "user_highest_roles", primary_key: "user_id", id: :bigint, default: nil, force: :cascade do |t| + t.datetime_with_timezone "updated_at", null: false + t.integer "highest_access_level" + t.index ["user_id", "highest_access_level"], name: "index_user_highest_roles_on_user_id_and_highest_access_level" + end + create_table "user_interacted_projects", id: false, force: :cascade do |t| t.integer "user_id", null: false t.integer "project_id", null: false @@ -5135,6 +5141,7 @@ ActiveRecord::Schema.define(version: 2020_03_11_165635) do add_foreign_key "user_callouts", "users", on_delete: :cascade add_foreign_key "user_custom_attributes", "users", on_delete: :cascade add_foreign_key "user_details", "users", on_delete: :cascade + add_foreign_key "user_highest_roles", "users", on_delete: :cascade add_foreign_key "user_interacted_projects", "projects", name: "fk_722ceba4f7", on_delete: :cascade add_foreign_key "user_interacted_projects", "users", name: "fk_0894651f08", on_delete: :cascade add_foreign_key "user_preferences", "users", on_delete: :cascade |