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.
66 lines
1.5 KiB
66 lines
1.5 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, default: "", 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, default: "", null: false
|
|
String :worse_legend, default: "", null: false
|
|
|
|
DateTime :created_at, null: false
|
|
DateTime :updated_at, null: false
|
|
end
|
|
|
|
create_table(:ratings) do
|
|
primary_key :id
|
|
|
|
# TODO constrain these to be from the same pool
|
|
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
|
|
|
|
create_table(:rankings) do
|
|
primary_key :id
|
|
|
|
# TODO constrain these to be from the same pool
|
|
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
|
|
end
|
|
end
|