Class: InitialSetup

Inherits:
ActiveRecord::Migration
  • Object
show all
Includes:
Goldberg::Migration
Defined in:
lib/six-updater-web/vendor/plugins/goldberg/db/migrate/001_initial_setup.rb

Class Method Summary collapse

Methods included from Goldberg::Migration

dump_bootstrap, dump_for_class, goldberg_classes, included, load_bootstrap, load_for_class

Class Method Details

.downObject



116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/six-updater-web/vendor/plugins/goldberg/db/migrate/001_initial_setup.rb', line 116

def self.down
  drop_table "#{prefix}users"
  drop_table "#{prefix}system_settings"
  drop_table "#{prefix}roles_permissions"
  drop_table "#{prefix}roles"
  drop_table "#{prefix}menu_items"
  drop_table "#{prefix}controller_actions"
  drop_table "#{prefix}content_pages"
  drop_table "#{prefix}site_controllers"
  drop_table "#{prefix}markup_styles"
  drop_table "#{prefix}permissions"
end

.upObject



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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/six-updater-web/vendor/plugins/goldberg/db/migrate/001_initial_setup.rb', line 3

def self.up

  create_table "#{prefix}permissions", :force => false do |t|
    t.column "name", :string, :default => "", :null => false
  end


  create_table "#{prefix}markup_styles", :force => false do |t|
    t.column "name", :string, :default => "", :null => false
  end


  create_table "#{prefix}site_controllers", :force => false do |t|
    t.column "name", :string, :default => "", :null => false
    t.column "permission_id", :integer, :default => 0, :null => false
    t.column "builtin", :integer, :default => 0
  end

  add_index "#{prefix}site_controllers", ["permission_id"], :name => "fk_site_controller_permission_id"


  create_table "#{prefix}content_pages", :force => false do |t|
    t.column "title", :string
    t.column "name", :string, :default => "", :null => false
    t.column "markup_style_id", :integer
    t.column "content", :text
    t.column "permission_id", :integer, :default => 0, :null => false
    t.column "created_at", :timestamp
    t.column "updated_at", :timestamp
  end

  add_index "#{prefix}content_pages", ["permission_id"], :name => "fk_content_page_permission_id"
  add_index "#{prefix}content_pages", ["markup_style_id"], :name => "fk_content_page_markup_style_id"


  create_table "#{prefix}controller_actions", :force => false do |t|
    t.column "site_controller_id", :integer, :default => 0, :null => false
    t.column "name", :string, :default => "", :null => false
    t.column "permission_id", :integer
  end

  add_index "#{prefix}controller_actions", ["permission_id"], :name => "fk_controller_action_permission_id"
  add_index "#{prefix}controller_actions", ["site_controller_id"], :name => "fk_controller_action_site_controller_id"


  create_table "#{prefix}menu_items", :force => false do |t|
    t.column "parent_id", :integer
    t.column "name", :string, :default => "", :null => false
    t.column "label", :string, :default => "", :null => false
    t.column "seq", :integer
    t.column "controller_action_id", :integer
    t.column "content_page_id", :integer
  end

  add_index "#{prefix}menu_items", ["controller_action_id"], :name => "fk_menu_item_controller_action_id"
  add_index "#{prefix}menu_items", ["content_page_id"], :name => "fk_menu_item_content_page_id"
  add_index "#{prefix}menu_items", ["parent_id"], :name => "fk_menu_item_parent_id"


  create_table "#{prefix}roles", :force => false do |t|
    t.column "name", :string, :default => "", :null => false
    t.column "parent_id", :integer
    t.column "description", :string, :limit => 255, :default => "", :null => false
    t.column "default_page_id", :integer
    t.column "cache", :text
    t.column "created_at", :timestamp
    t.column "updated_at", :timestamp
  end

  add_index "#{prefix}roles", ["parent_id"], :name => "fk_role_parent_id"
  add_index "#{prefix}roles", ["default_page_id"], :name => "fk_role_default_page_id"


  create_table "#{prefix}roles_permissions", :force => false do |t|
    t.column "role_id", :integer, :default => 0, :null => false
    t.column "permission_id", :integer, :default => 0, :null => false
  end

  add_index "#{prefix}roles_permissions", ["role_id"], :name => "fk_roles_permission_role_id"
  add_index "#{prefix}roles_permissions", ["permission_id"], :name => "fk_roles_permission_permission_id"


  create_table "#{prefix}system_settings", :force => false do |t|
    t.column "site_name", :string, :default => "", :null => false
    t.column "site_subtitle", :string
    t.column "footer_message", :string, :default => ""
    t.column "public_role_id", :integer, :default => 0, :null => false
    t.column "session_timeout", :integer, :default => 0, :null => false
    t.column "default_markup_style_id", :integer, :default => 0
    t.column "site_default_page_id", :integer, :default => 0, :null => false
    t.column "not_found_page_id", :integer, :default => 0, :null => false
    t.column "permission_denied_page_id", :integer, :default => 0, :null => false
    t.column "session_expired_page_id", :integer, :default => 0, :null => false
    t.column "menu_depth", :integer, :default => 0, :null => false
  end

  add_index "#{prefix}system_settings", ["public_role_id"], :name => "fk_system_settings_public_role_id"
  add_index "#{prefix}system_settings", ["site_default_page_id"], :name => "fk_system_settings_site_default_page_id"
  add_index "#{prefix}system_settings", ["not_found_page_id"], :name => "fk_system_settings_not_found_page_id"
  add_index "#{prefix}system_settings", ["permission_denied_page_id"], :name => "fk_system_settings_permission_denied_page_id"
  add_index "#{prefix}system_settings", ["session_expired_page_id"], :name => "fk_system_settings_session_expired_page_id"


  create_table "#{prefix}users", :force => false do |t|
    t.column "name", :string, :default => "", :null => false
    t.column "password", :string, :limit => 40, :default => "", :null => false
    t.column "role_id", :integer, :default => 0, :null => false
  end

  add_index "#{prefix}users", ["role_id"], :name => "fk_user_role_id"

end