Skip to content
Snippets Groups Projects
Commit 349764be authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

Order commits by committed_at and id

This needs to be done that way, because the committed_at can be null for some pretty old commits.
parent b0dc7c0b
No related branches found
No related tags found
No related merge requests found
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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
class AddIndexForCommittedAtAndId < ActiveRecord::Migration
def up
add_index :commits, [:project_id, :committed_at, :id]
end
end
Loading
Loading
@@ -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"
Loading
Loading
@@ -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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment