Skip to content

Instantly share code, notes, and snippets.

@dannypage
Created October 5, 2012 01:32
Show Gist options
  • Save dannypage/3837547 to your computer and use it in GitHub Desktop.
Save dannypage/3837547 to your computer and use it in GitHub Desktop.
Migrations Needed for OptaRails
class CreateOptaEvents < ActiveRecord::Migration
def change
create_table :opta_events, :id => false do |t|
t.column :opta_game_id, :integer, :null => false
t.column :id, :integer, :primary => true
t.column :event_id, :integer
t.column :type_id, :integer
t.column :period_id, :integer
t.column :timeline, :integer
t.column :min, :integer
t.column :sec, :integer
t.column :team_id, :integer
t.column :player_id, :integer
t.column :outcome, :boolean
t.column :assist, :integer
t.column :keypass, :integer
t.column :x, :decimal
t.column :y, :decimal
t.column :timestamp, :datetime
t.column :last_modified, :datetime
t.timestamps
end
end
end
class CreateOptaGames < ActiveRecord::Migration
def change
create_table :opta_games, :id => false do |t|
t.column :timestamp, :datetime, :null => false
t.column :id, :integer, :primary => true
t.column :away_team_id, :integer
t.column :away_team_name, :string
t.column :home_team_id, :integer
t.column :home_team_name, :string
t.column :competition_id, :integer
t.column :competition_name, :string
t.column :game_date, :datetime
t.column :matchday, :integer
t.column :period_1_start, :datetime
t.column :period_2_start, :datetime
t.column :period_3_start, :datetime
t.column :period_4_start, :datetime
t.column :period_5_start, :datetime
t.column :season_id, :integer
t.column :season_name, :string
t.column :filename, :string
t.timestamps
end
end
end
class CreateOptaQuals < ActiveRecord::Migration
def change
create_table :opta_quals, :id => false do |t|
t.column :opta_event_id, :integer, :null => false
t.column :id, :integer, :primary => true
t.column :qualification_id, :integer
t.column :value, :string
t.timestamps
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment