Created
May 10, 2014 04:16
-
-
Save mono0x/cef72a46a485e11d57dd to your computer and use it in GitHub Desktop.
database schema for ranking.sucretown.net
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateTables < ActiveRecord::Migration | |
def change | |
create_table :rankings do |t| | |
t.string :name, null: false, unique: true | |
end | |
add_index :rankings, :name | |
create_table :characters do |t| | |
t.string :name, null: false, unique: true | |
end | |
add_index :characters, :name | |
create_table :entries do |t| | |
t.integer :ranking_id, null: false | |
t.integer :character_id, null: false | |
end | |
add_index :entries, [ :ranking_id, :character_id ], unique: true | |
create_table :votes do |t| | |
t.integer :entry_id, null: false | |
t.integer :status_id, null: false, unique: true | |
t.date :date, null: false | |
t.integer :user_id, null: false | |
t.string :status, null: false | |
end | |
add_index :votes, [ :entry_id, :date, :user_id ], unique: true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment