5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/generators/templates/create_sites.rb', line 5
def self.up
create_table :sites, :force => true do |t|
t.string :name
t.string :lang
t.timestamps
end
add_index :sites, :name, :unique => true
TABLES.each do |tbl|
add_column tbl, :site_id, :integer
add_index tbl, :site_id
end
s = Atreides::Site.find_by_name('www') || Atreides::Site.create(:name => 'www')
TABLES.each do |tbl|
"Atreides::#{tbl.classify}".constantize.update_all({:site_id => s.id}, {:site_id => nil})
end
end
|