diff options
-rw-r--r-- | CHANGELOG | 5 | ||||
-rw-r--r-- | app/models/project.rb | 2 | ||||
-rw-r--r-- | db/migrate/20150824202238_add_index_for_committed_at_and_id.rb | 5 | ||||
-rw-r--r-- | db/schema.rb | 3 |
4 files changed, 12 insertions, 3 deletions
@@ -1,4 +1,7 @@ -v7.14.0 (unreleased) +v7.14.1 + - Fix commits ordering + +v7.14.0 - Truncate commit messages after subject line in table - Adjust CI config to support Docker executors - Added Application Settings diff --git a/app/models/project.rb b/app/models/project.rb index 4879f24..f0cf3a5 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -28,7 +28,7 @@ class Project < ActiveRecord::Base include ProjectStatus - has_many :commits, ->() { order(:committed_at) }, dependent: :destroy + has_many :commits, ->() { order(:committed_at, :id) }, dependent: :destroy has_many :builds, through: :commits, dependent: :destroy has_many :runner_projects, dependent: :destroy has_many :runners, through: :runner_projects diff --git a/db/migrate/20150824202238_add_index_for_committed_at_and_id.rb b/db/migrate/20150824202238_add_index_for_committed_at_and_id.rb new file mode 100644 index 0000000..3328b9b --- /dev/null +++ b/db/migrate/20150824202238_add_index_for_committed_at_and_id.rb @@ -0,0 +1,5 @@ +class AddIndexForCommittedAtAndId < ActiveRecord::Migration + def up + add_index :commits, [:project_id, :committed_at, :id] + end +end diff --git a/db/schema.rb b/db/schema.rb index 6f630ab..db684af 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: 20150819162227) do +ActiveRecord::Schema.define(version: 20150824202238) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -62,6 +62,7 @@ ActiveRecord::Schema.define(version: 20150819162227) do t.datetime "committed_at" end + add_index "commits", ["project_id", "committed_at", "id"], name: "index_commits_on_project_id_and_committed_at_and_id", using: :btree add_index "commits", ["project_id", "committed_at"], name: "index_commits_on_project_id_and_committed_at", using: :btree add_index "commits", ["project_id", "sha"], name: "index_commits_on_project_id_and_sha", using: :btree add_index "commits", ["project_id"], name: "index_commits_on_project_id", using: :btree |