Merge initial schema migrations

This commit is contained in:
Thor77 2018-11-11 19:57:59 +01:00
parent 5774b2463a
commit 821c40c35c
No known key found for this signature in database
GPG Key ID: 5051E71B46AA669A
6 changed files with 39 additions and 75 deletions

View File

@ -1,8 +1,45 @@
# frozen_string_literal: true
class DeviseTokenAuthCreateUsers < ActiveRecord::Migration[5.2]
class CreateSchema < ActiveRecord::Migration[5.2]
def change
create_table(:users) do |t|
create_table :groups do |t|
t.string :name
t.timestamps
end
create_table :group_stages do |t|
t.integer :playoff_size
t.timestamps
end
create_table :matches do |t|
t.integer :score_team_1
t.integer :score_team_2
t.integer :state
t.integer :position
t.boolean :is_group_match
t.timestamps
end
create_table :playoff_stages do |t|
t.integer :level
t.timestamps
end
create_table :teams do |t|
t.string :name
t.integer :group_score
t.integer :group_points_scored
t.integer :group_points_recieved
t.timestamps
end
create_table :users do |t|
## Required
t.string :provider, null: false, default: 'email'
t.string :uid, null: false, default: ''

View File

@ -1,14 +0,0 @@
# frozen_string_literal: true
class CreateGroups < ActiveRecord::Migration[5.2]
def change
create_table :groups do |t|
t.integer :id
t.references :matches, foreign_key: true
t.references :teams, foreign_key: true
t.string :name
t.timestamps
end
end
end

View File

@ -1,13 +0,0 @@
# frozen_string_literal: true
class CreateGroupStages < ActiveRecord::Migration[5.2]
def change
create_table :group_stages do |t|
t.integer :id
t.reference :groups
t.integer :playoff_size
t.timestamps
end
end
end

View File

@ -1,18 +0,0 @@
# frozen_string_literal: true
class CreateMatches < ActiveRecord::Migration[5.2]
def change
create_table :matches do |t|
t.integer :id
t.reference :team_1
t.reference :team_2
t.integer :score_team_1
t.integer :score_team_2
t.integer :state
t.integer :position
t.boolean :is_group_match
t.timestamps
end
end
end

View File

@ -1,13 +0,0 @@
# frozen_string_literal: true
class CreatePlayoffStages < ActiveRecord::Migration[5.2]
def change
create_table :playoff_stages do |t|
t.integer :id
t.integer :level
t.reference :matches
t.timestamps
end
end
end

View File

@ -1,15 +0,0 @@
# frozen_string_literal: true
class CreateTeams < ActiveRecord::Migration[5.2]
def change
create_table :teams do |t|
t.integer :id
t.string :name
t.integer :group_score
t.integer :group_points_scored
t.integer :group_points_recieved
t.timestamps
end
end
end