diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-07-27 19:42:15 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-08-10 17:45:49 +0200 |
commit | aac1de46c9be659b74da12f704412f38292974db (patch) | |
tree | 69882b53b3fff8adfe6a049a61708c4c4c39a674 /db/schema.rb | |
parent | 0395c47193b3bbf6b4f060f28c9f632580313a35 (diff) | |
download | gitlab-ce-aac1de46c9be659b74da12f704412f38292974db.tar.gz |
Use a specialized class for querying events
This changes various controllers to use the new EventCollection class
for retrieving events. This class uses a JOIN LATERAL query on
PostgreSQL to retrieve queries in a more efficient way, while falling
back to a simpler / less efficient query for MySQL.
The EventCollection class also includes a limit on the number of events
to display to prevent malicious users from cycling through all events,
as doing so could put a lot of pressure on the database.
JOIN LATERAL is only supported on PostgreSQL starting with version 9.3.0
and as such this optimisation is only used when using PostgreSQL 9.3 or
newer.
Diffstat (limited to 'db/schema.rb')
-rw-r--r-- | db/schema.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/db/schema.rb b/db/schema.rb index 8a2df991f0d..d8e8ef41758 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -530,7 +530,7 @@ ActiveRecord::Schema.define(version: 20170807160457) do add_index "events", ["action"], name: "index_events_on_action", using: :btree add_index "events", ["author_id"], name: "index_events_on_author_id", using: :btree add_index "events", ["created_at"], name: "index_events_on_created_at", using: :btree - add_index "events", ["project_id"], name: "index_events_on_project_id", using: :btree + add_index "events", ["project_id", "id"], name: "index_events_on_project_id_and_id", using: :btree add_index "events", ["target_id"], name: "index_events_on_target_id", using: :btree add_index "events", ["target_type"], name: "index_events_on_target_type", using: :btree @@ -546,7 +546,7 @@ ActiveRecord::Schema.define(version: 20170807160457) do add_index "events_for_migration", ["action"], name: "index_events_for_migration_on_action", using: :btree add_index "events_for_migration", ["author_id"], name: "index_events_for_migration_on_author_id", using: :btree - add_index "events_for_migration", ["project_id"], name: "index_events_for_migration_on_project_id", using: :btree + add_index "events_for_migration", ["project_id", "id"], name: "index_events_for_migration_on_project_id_and_id", using: :btree add_index "events_for_migration", ["target_type", "target_id"], name: "index_events_for_migration_on_target_type_and_target_id", using: :btree create_table "feature_gates", force: :cascade do |t| |