class AddOrganizations < ActiveRecord::Migration
def self.up
create_table :organizations do |t|
t.column :name, :string, :limit => 50, :null => false
end
end
def self.down
drop_table :organizations
end
end
class AddUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.column :first_name, :string, :limit => 50, :null => false
t.column :last_name, :string, :limit => 50, :null => false
t.column :email, :string, :limit => 100, :null => false
t.column :password_hash, :string, :limit => 64, :null => false
t.column :organization_id, :integer, :null => false
end
add_index :users, :email, :unique => true
end
def self.down
drop_table :users
end
end
class AddProjects < ActiveRecord::Migration
def self.up
create_table :projects do |t|
t.column :name, :string, :limit => 50, :null => false
t.column :organization_id, :integer, :null => false
end
end
def self.down
drop_table :projects
end
end
class AddProjectsUsers < ActiveRecord::Migration
def self.up
create_table :projects_users do |t|
t.column :project_id, :integer, :null => false
t.column :user_id, :integer, :null => false
t.column :role_type, :integer, :null => false
end
end
def self.down
drop_table :projects_users
end
end
|