diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-07-13 12:22:02 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2018-07-25 15:12:41 +0200 |
commit | 812bfb158b70b09cfd438379a4b9446aa85b52ec (patch) | |
tree | ee252f7086632223ecc483967f89d8a7b3014054 /db | |
parent | 3f14c56bfe77e83084b58dc2bd3c34e3c84c6cae (diff) | |
download | gitlab-ce-812bfb158b70b09cfd438379a4b9446aa85b52ec.tar.gz |
Add the `UserStatus` model
This model will hold the status of a user, including these fields:
- emoji: always present, with a default value
- user: always present, foreign key to user
- message: optional, maximum length of 100
The table also stores
- cached_markdown_version
- message_html
For rendering markdown in the `message` field.
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20180713092803_create_user_statuses.rb | 20 | ||||
-rw-r--r-- | db/schema.rb | 8 |
2 files changed, 28 insertions, 0 deletions
diff --git a/db/migrate/20180713092803_create_user_statuses.rb b/db/migrate/20180713092803_create_user_statuses.rb new file mode 100644 index 00000000000..cbe21b89ad9 --- /dev/null +++ b/db/migrate/20180713092803_create_user_statuses.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class CreateUserStatuses < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :user_statuses, id: false, primary_key: :user_id do |t| + t.references :user, + foreign_key: { on_delete: :cascade }, + null: false, + primary_key: true + t.integer :cached_markdown_version, limit: 4 + t.string :emoji, null: false, default: 'speech_balloon' + t.string :message, limit: 100 + t.string :message_html + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 3db11d8447e..c91d565342e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2048,6 +2048,13 @@ ActiveRecord::Schema.define(version: 20180722103201) do add_index "user_interacted_projects", ["project_id", "user_id"], name: "index_user_interacted_projects_on_project_id_and_user_id", unique: true, using: :btree add_index "user_interacted_projects", ["user_id"], name: "index_user_interacted_projects_on_user_id", using: :btree + create_table "user_statuses", primary_key: "user_id", force: :cascade do |t| + t.integer "cached_markdown_version" + t.string "emoji", default: "speech_balloon", null: false + t.string "message", limit: 100 + t.string "message_html" + end + create_table "user_synced_attributes_metadata", force: :cascade do |t| t.boolean "name_synced", default: false t.boolean "email_synced", default: false @@ -2349,6 +2356,7 @@ ActiveRecord::Schema.define(version: 20180722103201) do add_foreign_key "user_custom_attributes", "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_statuses", "users", on_delete: :cascade add_foreign_key "user_synced_attributes_metadata", "users", on_delete: :cascade add_foreign_key "users", "application_setting_terms", column: "accepted_term_id", name: "fk_789cd90b35", on_delete: :cascade add_foreign_key "users_star_projects", "projects", name: "fk_22cd27ddfc", on_delete: :cascade |