Skip to content

Instantly share code, notes, and snippets.

@apa512
Created April 7, 2016 23:28
Show Gist options
  • Save apa512/6d948bc88e7f2305a7e550f2692265ef to your computer and use it in GitHub Desktop.
Save apa512/6d948bc88e7f2305a7e550f2692265ef to your computer and use it in GitHub Desktop.
class CreateGithubTables < ActiveRecord::Migration
def up
rename_table :github_repositories, :github_repositories_old
create_table "github_repositories" do |t|
t.text "owner"
t.text "name"
t.integer "parent_id"
t.text "description"
t.text "website_url"
t.jsonb "languages", array: true
t.integer "stargazer_count"
t.integer "watcher_count"
t.integer "fork_count"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "contributions_updated_at"
t.jsonb "raw_data"
t.text "libraries", array: true
end
add_index "github_repositories", ["contributions_updated_at"], name: "index_github_repositories_on_contributions_updated_at", using: :btree
add_index "github_repositories", ["owner", "name"], name: "index_github_repositories_on_owner_and_name", unique: true, using: :btree
create_table "github_repository_contributions" do |t|
t.integer "github_repository_id"
t.uuid "profile_id"
t.integer "contributions"
end
add_index "github_repository_contributions", ["github_repository_id", "profile_id"], name: "index_join_keys_on_github_repository_collaborators", unique: true, using: :btree
add_index "github_repository_contributions", ["github_repository_id"], name: "index_github_repository_contributions_on_github_repository_id", using: :btree
add_index "github_repository_contributions", ["profile_id"], name: "index_github_repository_contributions_on_profile_id", using: :btree
end
def down
drop_table :github_repositories
rename_table :github_repositories_old, :github_repositories
drop_table :github_repository_contributions
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment