This repository has been archived by the owner on May 10, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 118
Save tags and branches properly #320
Open
drogus
wants to merge
6
commits into
master
Choose a base branch
from
ps-tags-and-branches
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
18b6044
Add models and tables for branches and tags
drogus 827450b
Properly save branch and tag info
drogus b9eb61f
Don't create more than one commit for the same sha
drogus fcf35c8
Use Travis::RetryOn
drogus 0295df6
Add caller to deprecation warnings
drogus a0f62b7
WIP
drogus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class CreateBranches < ActiveRecord::Migration | ||
def change | ||
create_table :branches do |t| | ||
t.string :name, null: false | ||
t.references :repository, null: false | ||
t.references :last_build | ||
t.foreign_key :repositories | ||
t.foreign_key :builds, column: :last_build_id | ||
|
||
t.timestamps | ||
end | ||
|
||
add_index :branches, :repository_id | ||
add_index :branches, [:name, :repository_id], unique: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class CreateBuildsBranches < ActiveRecord::Migration | ||
def change | ||
create_table :builds_branches do |t| | ||
t.references :build, null: false | ||
t.references :branch, null: false | ||
t.foreign_key :builds, dependent: :delete | ||
t.foreign_key :branches, dependent: :delete | ||
|
||
t.timestamps | ||
end | ||
|
||
add_index :builds_branches, :build_id | ||
add_index :builds_branches, :branch_id | ||
add_index :builds_branches, [:build_id, :branch_id], unique: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class CreateTags < ActiveRecord::Migration | ||
def change | ||
create_table :tags do |t| | ||
t.string :name, null: false | ||
t.references :last_build | ||
t.references :repository, null: false | ||
t.foreign_key :repositories | ||
t.foreign_key :builds, column: :last_build_id | ||
|
||
t.timestamps | ||
end | ||
|
||
add_index :tags, :repository_id | ||
add_index :tags, [:name, :repository_id], unique: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class CreateBuildsTags < ActiveRecord::Migration | ||
def change | ||
create_table :builds_tags do |t| | ||
t.references :build, null: false | ||
t.references :tag, null: false | ||
t.foreign_key :builds, dependent: :delete | ||
t.foreign_key :tags, dependent: :delete | ||
|
||
t.timestamps | ||
end | ||
|
||
add_index :builds_tags, :build_id | ||
add_index :builds_tags, :tag_id | ||
add_index :builds_tags, [:build_id, :tag_id], unique: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class CreateCommitsTags < ActiveRecord::Migration | ||
def change | ||
create_table :commits_tags do |t| | ||
t.references :commit | ||
t.references :tag | ||
t.references :request | ||
|
||
t.foreign_key :commits, dependent: :delete | ||
t.foreign_key :tags, dependent: :delete | ||
t.foreign_key :requests, dependent: :delete | ||
|
||
t.timestamps | ||
end | ||
|
||
add_index :commits_tags, [:commit_id, :tag_id], unique: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class CreateCommitsBranches < ActiveRecord::Migration | ||
def change | ||
create_table :commits_branches do |t| | ||
t.references :commit | ||
t.references :branch | ||
t.references :request | ||
|
||
t.foreign_key :commits, dependent: :delete | ||
t.foreign_key :branches, dependent: :delete | ||
t.foreign_key :requests, dependent: :delete | ||
|
||
t.timestamps | ||
end | ||
|
||
add_index :commits_branches, [:commit_id, :branch_id], unique: true | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are both of these indices necessary, or is only the last one needed? I've seen Postgres use only one or some of the columns in a multi-column index before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PG in general can use multi column indexes for single column queries, but it will be less performant - the first field in multi column index will be the fastest to check. Maybe it's a premature optimization, but queries by name and by repository_id will be done every time new build is added, so I assume that having 2 indexes will help and rather not hurt.