diff options
author | Markus Koller <markus-koller@gmx.ch> | 2017-09-28 16:49:42 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-09-28 16:49:42 +0000 |
commit | e9eae3eb0dd25e4a34c9a4b6bcc7de312dde4489 (patch) | |
tree | d2402a99dd96927ae458f49cbd7de8ad043e297a /db | |
parent | 93a33556e3e01a83c1af9c21e11ff433b624c40d (diff) | |
download | gitlab-ce-e9eae3eb0dd25e4a34c9a4b6bcc7de312dde4489.tar.gz |
Support custom attributes on users
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20170720122741_create_user_custom_attributes.rb | 17 | ||||
-rw-r--r-- | db/schema.rb | 12 |
2 files changed, 29 insertions, 0 deletions
diff --git a/db/migrate/20170720122741_create_user_custom_attributes.rb b/db/migrate/20170720122741_create_user_custom_attributes.rb new file mode 100644 index 00000000000..b1c0bebc633 --- /dev/null +++ b/db/migrate/20170720122741_create_user_custom_attributes.rb @@ -0,0 +1,17 @@ +class CreateUserCustomAttributes < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :user_custom_attributes do |t| + t.timestamps_with_timezone null: false + t.references :user, null: false, foreign_key: { on_delete: :cascade } + t.string :key, null: false + t.string :value, null: false + + t.index [:user_id, :key], unique: true + t.index [:key, :value] + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 330336e8e61..63c8b8b3f49 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1534,6 +1534,17 @@ ActiveRecord::Schema.define(version: 20170921115009) do add_index "user_agent_details", ["subject_id", "subject_type"], name: "index_user_agent_details_on_subject_id_and_subject_type", using: :btree + create_table "user_custom_attributes", force: :cascade do |t| + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "user_id", null: false + t.string "key", null: false + t.string "value", null: false + end + + add_index "user_custom_attributes", ["key", "value"], name: "index_user_custom_attributes_on_key_and_value", using: :btree + add_index "user_custom_attributes", ["user_id", "key"], name: "index_user_custom_attributes_on_user_id_and_key", unique: true, using: :btree + create_table "user_synced_attributes_metadata", force: :cascade do |t| t.boolean "name_synced", default: false t.boolean "email_synced", default: false @@ -1760,6 +1771,7 @@ ActiveRecord::Schema.define(version: 20170921115009) do add_foreign_key "todos", "projects", name: "fk_45054f9c45", on_delete: :cascade add_foreign_key "trending_projects", "projects", on_delete: :cascade add_foreign_key "u2f_registrations", "users" + add_foreign_key "user_custom_attributes", "users", on_delete: :cascade add_foreign_key "user_synced_attributes_metadata", "users", on_delete: :cascade add_foreign_key "users_star_projects", "projects", name: "fk_22cd27ddfc", on_delete: :cascade add_foreign_key "web_hook_logs", "web_hooks", on_delete: :cascade |