Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mono0x
Created May 10, 2014 04:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mono0x/cef72a46a485e11d57dd to your computer and use it in GitHub Desktop.
Save mono0x/cef72a46a485e11d57dd to your computer and use it in GitHub Desktop.
database schema for ranking.sucretown.net
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