Skip to content

Commit

Permalink
Add indexes
Browse files Browse the repository at this point in the history
* Add index to users for remember_token
* Add index to repos for active
* Add unique index to repos for github_id
  • Loading branch information
salbertson committed Apr 21, 2014
1 parent dfeeee4 commit 7a61c26
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddIndexForRememberTokenToUsers < ActiveRecord::Migration
def change
add_index :users, :remember_token
end
end
5 changes: 5 additions & 0 deletions db/migrate/20140418144357_add_index_for_github_id_to_repos.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddIndexForGithubIdToRepos < ActiveRecord::Migration
def change
add_index :repos, :github_id, unique: true
end
end
5 changes: 5 additions & 0 deletions db/migrate/20140419235609_add_index_for_active_to_repos.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddIndexForActiveToRepos < ActiveRecord::Migration
def change
add_index :repos, :active
end
end
9 changes: 7 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20140417232711) do
ActiveRecord::Schema.define(version: 20140419235609) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -55,18 +55,23 @@
create_table "repos", force: true do |t|
t.integer "github_id", null: false
t.boolean "active", default: false, null: false
t.integer "hook_id"
t.string "name", null: false
t.string "full_github_name", null: false
t.integer "hook_id"
t.datetime "created_at"
t.datetime "updated_at"
end

add_index "repos", ["active"], name: "index_repos_on_active", using: :btree
add_index "repos", ["github_id"], name: "index_repos_on_github_id", unique: true, using: :btree

create_table "users", force: true do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "github_username", null: false
t.string "remember_token", null: false
end

add_index "users", ["remember_token"], name: "index_users_on_remember_token", using: :btree

end

0 comments on commit 7a61c26

Please sign in to comment.