diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-08-09 15:49:30 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-08-10 12:52:57 +0200 |
commit | 12b8e2f05a3469240cf986f6b0135d4121cb5b0a (patch) | |
tree | 717f4cd7c589a596c908151544610d8b9d494c6c /db/schema.rb | |
parent | 53ee38053cb924b57447e385dee2a45b8e759ff5 (diff) | |
download | gitlab-ce-broadcast-messages-cache.tar.gz |
Better caching and indexing of broadcast messagesbroadcast-messages-cache
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 | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/db/schema.rb b/db/schema.rb index ed3cf70bcdd..032ab6ec15d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20170807160457) do +ActiveRecord::Schema.define(version: 20170809134534) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -163,16 +163,18 @@ ActiveRecord::Schema.define(version: 20170807160457) 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 |