forked from tog/tog_social
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path001_create_tog_social_tables.rb
55 lines (51 loc) · 1.25 KB
/
001_create_tog_social_tables.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
class CreateTogSocialTables < ActiveRecord::Migration
def self.up
create_table :profiles do |t|
t.integer :user_id
t.string :first_name
t.string :last_name
t.string :website
t.string :blog
t.string :icon
t.timestamps
end
User.find(:all).each{|u|
profile = Profile.new
profile.user = u
profile.save!
}
create_table :groups do |t|
t.string :name
t.string :description
t.string :image
t.string :state
t.boolean :private
t.boolean :moderated, :default => false
t.integer :user_id
t.string :activation_code, :limit => 40
t.datetime :activated_at
t.timestamps
end
create_table :memberships do |t|
t.integer :user_id
t.integer :group_id
t.boolean :moderator, :default => false
t.string :state
t.string :activation_code, :limit => 40
t.datetime :activated_at
t.timestamps
end
create_table :friendships do |t|
t.integer :inviter_id
t.integer :invited_id
t.integer :status
t.timestamps
end
end
def self.down
drop_table :friendships
drop_table :memberships
drop_table :groups
drop_table :profiles
end
end