1 class CreateGroups < ActiveRecord::Migration
3 create_table :groups do |t|
4 t.column "g_title", :string, :limit => 50, :default => "", :null => false
5 t.column "g_user_title", :string, :limit => 50
6 t.column "g_read_board", :boolean, :default => true, :null => false
7 t.column "g_post_replies", :boolean, :default => true, :null => false
8 t.column "g_post_topics", :boolean, :default => true, :null => false
9 t.column "g_post_polls", :boolean, :default => true, :null => false
10 t.column "g_edit_posts", :boolean, :default => true, :null => false
11 t.column "g_delete_posts", :boolean, :default => true, :null => false
12 t.column "g_delete_topics", :boolean, :default => true, :null => false
13 t.column "g_set_title", :boolean, :default => true, :null => false
14 t.column "g_search", :boolean, :default => true, :null => false
15 t.column "g_search_users", :boolean, :default => true, :null => false
16 t.column "g_edit_subjects_interval", :integer, :limit => 6, :default => 300, :null => false
17 t.column "g_post_flood", :integer, :limit => 6, :default => 30, :null => false
18 t.column "g_search_flood", :integer, :limit => 6, :default => 30, :null => false
21 say_with_time "Adding default groups ..." do
22 path = "db/migrate/groups.yaml"
23 records = YAML::load(File.open(File.expand_path(path, RAILS_ROOT)))
24 records.each do |record|
25 record_copy = Group.create(record[1])