diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-08-09 16:49:30 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-08-11 17:43:30 +0300 |
commit | a5c8a52782ae6e948adbbba77c0ec702ffe28ae1 (patch) | |
tree | 1a46e36340cb87ed2768f47d049dd2d705acd947 /db/schema.rb | |
parent | e80a893ff0ea8466099f6478183631af55933db2 (diff) |
Better caching and indexing of broadcast messages
Caching of BroadcastMessage instances has been changed so a cache stays
valid as long as the default cache expiration time permits, instead of
the cache being expired after 1 minute. When modifying broadcast
messages the cache is flushed automatically.
To remove the need for performing sequence scans on the
"broadcast_messages" table we also add an index on (starts_at, ends_at,
id), permitting PostgreSQL to use an index scan to get all necessary
data.
Finally this commit adds a few NOT NULL constraints to the table to
match the Rails validations.
Fixes gitlab-org/gitlab-ce#31706
Diffstat (limited to 'db/schema.rb')
-rw-r--r-- | db/schema.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/db/schema.rb b/db/schema.rb index 65afe37a21c..9d3b3ad1826 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -163,16 +163,18 @@ ActiveRecord::Schema.define(version: 20170809142252) do create_table "broadcast_messages", force: :cascade do |t| t.text "message", null: false - t.datetime "starts_at" - t.datetime "ends_at" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "starts_at", null: false + t.datetime "ends_at", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.string "color" t.string "font" - t.text "message_html" + t.text "message_html", null: false t.integer "cached_markdown_version" end + add_index "broadcast_messages", ["starts_at", "ends_at", "id"], name: "index_broadcast_messages_on_starts_at_and_ends_at_and_id", using: :btree + create_table "chat_names", force: :cascade do |t| t.integer "user_id", null: false t.integer "service_id", null: false |