You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.4 KiB
64 lines
1.4 KiB
# frozen_string_literal: true
|
|
|
|
Sequel.migration do
|
|
change do
|
|
create_table(:pools) do
|
|
primary_key :id
|
|
|
|
String :name, null: false
|
|
|
|
DateTime :created_at, null: false
|
|
DateTime :updated_at, null: false
|
|
end
|
|
|
|
create_table(:items) do
|
|
primary_key :id
|
|
|
|
foreign_key :pool_id, :pools, null: false
|
|
|
|
String :title, null: false
|
|
String :body, null: false
|
|
|
|
DateTime :created_at, null: false
|
|
DateTime :updated_at, null: false
|
|
end
|
|
|
|
create_table(:axes) do
|
|
primary_key :id
|
|
|
|
foreign_key :pool_id, :pools, null: false
|
|
|
|
String :name, null: false
|
|
String :better_legend, null: false
|
|
String :worse_legend, null: false
|
|
|
|
DateTime :created_at, null: false
|
|
DateTime :updated_at, null: false
|
|
end
|
|
|
|
create_table(:ratings) do
|
|
primary_key :id
|
|
|
|
foreign_key :axis_id, :axes, null: false
|
|
foreign_key :winner_id, :items, null: false
|
|
foreign_key :loser_id, :items, null: false
|
|
|
|
DateTime :created_at, null: false
|
|
DateTime :updated_at, null: false
|
|
end
|
|
|
|
create_table(:rankings) do
|
|
primary_key :id
|
|
|
|
foreign_key :axis_id, :axes, null: false
|
|
foreign_key :item_id, :items, null: false
|
|
|
|
float :mu, null: false
|
|
float :sigma, null: false
|
|
|
|
DateTime :created_at, null: false
|
|
DateTime :updated_at, null: false
|
|
end
|
|
end
|
|
end
|