knitkit 2.1.11 → 2.1.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/app/controllers/knitkit/erp_app/desktop/theme_controller.rb +1 -1
  2. data/app/models/theme.rb +1 -1
  3. data/app/models/website.rb +4 -1
  4. data/lib/knitkit/version.rb +1 -1
  5. data/spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb +15 -0
  6. data/spec/dummy/db/data_migrations/20110509223702_add_publisher_role.knitkit.rb +22 -0
  7. data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +12 -0
  8. data/spec/dummy/db/data_migrations/20110608185830_create_default_dynamic_models_and_forms.erp_forms.rb +33 -0
  9. data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +19 -0
  10. data/spec/dummy/db/data_migrations/20110728201729_erp_app_setup.erp_app.rb +252 -0
  11. data/spec/dummy/db/data_migrations/20110728201733_update_preferences.erp_app.rb +53 -0
  12. data/spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +16 -0
  13. data/spec/dummy/db/data_migrations/20110816153456_add_knitkit_application.knitkit.rb +32 -0
  14. data/spec/dummy/db/data_migrations/20110816161238_create_desktop_app_audit_log_viewer.erp_app.rb +21 -0
  15. data/spec/dummy/db/data_migrations/20110817160743_add_file_manager_application.erp_app.rb +32 -0
  16. data/spec/dummy/db/data_migrations/20110828190913_create_desktop_app_dynamic_forms.erp_forms.rb +19 -0
  17. data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +12 -0
  18. data/spec/dummy/db/data_migrations/20111108183739_add_default_capabilities.erp_app.rb +23 -0
  19. data/spec/dummy/db/data_migrations/20111108183740_add_new_contact_widgets.erp_app.rb +42 -0
  20. data/spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb +22 -0
  21. data/spec/dummy/db/data_migrations/20111118182910_setup_knitkit_capabilities.knitkit.rb +128 -0
  22. data/spec/dummy/db/data_migrations/20120127144444_create_website_role_types.knitkit.rb +14 -0
  23. data/spec/dummy/db/data_migrations/20120127150505_create_website_default_configuration.knitkit.rb +73 -0
  24. data/spec/dummy/db/data_migrations/20120127150506_add_primary_host_to_website_configuration.knitkit.rb +34 -0
  25. data/spec/dummy/db/data_migrations/20120229160222_add_userinfo_widget.erp_app.rb +29 -0
  26. data/spec/dummy/db/data_migrations/20120316150424_add_is_template_to_default_website_config.knitkit.rb +17 -0
  27. data/spec/dummy/db/data_migrations/20120405193721_create_party_and_role_type_for_communication_events.erp_app.rb +11 -0
  28. data/spec/dummy/db/data_migrations/20120411180756_create_user_management_mobile_application.erp_app.rb +19 -0
  29. data/spec/dummy/db/data_migrations/20120418164215_create_configuration_management_desktop_application.erp_app.rb +23 -0
  30. data/spec/dummy/db/data_migrations/20120809020508_update_website_and_configuration.knitkit.rb +78 -0
  31. data/spec/dummy/db/data_migrations/20120824013449_create_ticket_form.erp_forms.rb +67 -0
  32. data/spec/dummy/db/data_migrations/20121026013449_update_ticket_form.erp_forms.rb +65 -0
  33. data/spec/dummy/db/data_migrations/20121026191738_update_contact_form.erp_forms.rb +27 -0
  34. data/spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb +20 -0
  35. data/spec/dummy/db/data_migrations/20121129185611_upgrade_website_role_iid.knitkit.rb +21 -0
  36. data/spec/dummy/db/data_migrations/20121130201859_upgrade_remove_system_mgmt_app.erp_app.rb +16 -0
  37. data/spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb +24 -0
  38. data/spec/dummy/db/data_migrations/20121218175028_create_security_management_desktop_application.erp_app.rb +23 -0
  39. data/spec/dummy/db/data_migrations/20130422154409_upgrade_compass_ae_instances_data.erp_base_erp_svcs.rb +19 -0
  40. data/spec/dummy/db/data_migrations/20130422154410_add_guid_to_instances.erp_base_erp_svcs.rb +10 -0
  41. data/spec/dummy/db/data_migrations/20130422154411_create_job_tracker_desktop_application.erp_app.rb +23 -0
  42. data/spec/dummy/db/data_migrations/20130422154412_created_tracked_jobs.erp_app.rb +15 -0
  43. data/spec/dummy/db/data_migrations/20130422154413_add_job_tracker_mobile_app.erp_app.rb +17 -0
  44. data/spec/dummy/db/migrate/20130107153232_base_erp_services.erp_base_erp_svcs.rb +461 -0
  45. data/spec/dummy/db/migrate/20130107153233_base_tech_services.erp_tech_svcs.rb +271 -0
  46. data/spec/dummy/db/migrate/20130107153234_create_has_attribute_tables.erp_tech_svcs.rb +39 -0
  47. data/spec/dummy/db/migrate/20130107153235_create_groups.erp_tech_svcs.rb +19 -0
  48. data/spec/dummy/db/migrate/20130107153236_upgrade_security.erp_tech_svcs.rb +54 -0
  49. data/spec/dummy/db/migrate/20130107153237_upgrade_security2.erp_tech_svcs.rb +270 -0
  50. data/spec/dummy/db/migrate/20130107153238_base_app_framework.erp_app.rb +276 -0
  51. data/spec/dummy/db/migrate/20130107153239_dynamic_forms.erp_forms.rb +95 -0
  52. data/spec/dummy/db/migrate/20130107153240_create_tickets.erp_forms.rb +19 -0
  53. data/spec/dummy/db/migrate/20130107153241_upgrade_dynamic_forms_table.erp_forms.rb +32 -0
  54. data/spec/dummy/db/migrate/20130107153242_setup_knitkit.knitkit.rb +316 -0
  55. data/spec/dummy/db/migrate/20130422154401_add_txn_status.erp_base_erp_svcs.rb +37 -0
  56. data/spec/dummy/db/migrate/20130422154402_upgrade_compass_ae_instances.erp_base_erp_svcs.rb +34 -0
  57. data/spec/dummy/db/migrate/20130422154403_add_uuid_compass_ae_instance.erp_base_erp_svcs.rb +17 -0
  58. data/spec/dummy/db/migrate/20130422154404_add_long_lat_to_address.erp_base_erp_svcs.rb +16 -0
  59. data/spec/dummy/db/migrate/20130422154405_add_queue_to_delayed_jobs.erp_tech_svcs.rb +14 -0
  60. data/spec/dummy/db/migrate/20130422154406_add_job_tracker.erp_app.rb +20 -0
  61. data/spec/dummy/db/migrate/20130422154407_update_mobile_application.erp_app.rb +28 -0
  62. data/spec/dummy/db/migrate/20130422154408_add_use_markdown_to_section.knitkit.rb +20 -0
  63. data/spec/dummy/db/schema.rb +1248 -0
  64. data/spec/dummy/db/spec.sqlite3 +0 -0
  65. metadata +123 -3
@@ -0,0 +1,276 @@
1
+ # This migration comes from erp_app (originally 20080805000096)
2
+ class BaseAppFramework < ActiveRecord::Migration
3
+ def self.up
4
+
5
+ unless table_exists?(:preferences)
6
+ create_table :preferences do |t|
7
+ t.references :preference_option
8
+ t.references :preference_type
9
+
10
+ t.timestamps
11
+ end
12
+ add_index :preferences, :preference_option_id
13
+ add_index :preferences, :preference_type_id
14
+ end
15
+
16
+ unless table_exists?(:preference_types)
17
+ create_table :preference_types do |t|
18
+ t.string :description
19
+ t.string :internal_identifier
20
+ t.integer :default_pref_option_id
21
+
22
+ t.timestamps
23
+ end
24
+
25
+ add_index :preference_types, :default_pref_option_id
26
+ end
27
+
28
+ unless table_exists?(:preference_options)
29
+ create_table :preference_options do |t|
30
+ t.string :description
31
+ t.string :internal_identifier
32
+ t.string :value
33
+
34
+ t.timestamps
35
+ end
36
+ end
37
+
38
+ unless table_exists?(:preference_options_preference_types)
39
+ create_table :preference_options_preference_types, {:id => false} do |t|
40
+ t.references :preference_type
41
+ t.references :preference_option
42
+ end
43
+
44
+ add_index :preference_options_preference_types, :preference_type_id, :name => 'pref_opt_pref_type_pref_type_id_idx'
45
+ add_index :preference_options_preference_types, :preference_option_id, :name => 'pref_opt_pref_type_pref_opt_id_idx'
46
+ end
47
+
48
+ unless table_exists?(:valid_preference_types)
49
+ create_table :valid_preference_types do |t|
50
+ t.references :preference_type
51
+ t.references :preferenced_record, :polymorphic => true
52
+ end
53
+ end
54
+
55
+ unless table_exists?(:user_preferences)
56
+ create_table :user_preferences do |t|
57
+ t.references :user
58
+ t.references :preference
59
+
60
+ t.references :preferenced_record, :polymorphic => true
61
+
62
+ t.timestamps
63
+ end
64
+ add_index :user_preferences, :user_id
65
+ add_index :user_preferences, :preference_id
66
+ add_index :user_preferences, :preferenced_record_id
67
+ add_index :user_preferences, :preferenced_record_type
68
+ end
69
+
70
+ unless table_exists?(:app_containers)
71
+ create_table :app_containers do |t|
72
+ t.references :user
73
+ t.string :description
74
+ t.string :internal_identifier
75
+ t.string :type
76
+
77
+ t.timestamps
78
+ end
79
+ add_index :app_containers, :user_id
80
+ add_index :app_containers, :type
81
+ end
82
+
83
+ unless table_exists?(:applications)
84
+ create_table :applications do |t|
85
+ t.column :description, :string
86
+ t.column :icon, :string
87
+ t.column :internal_identifier, :string
88
+ t.column :javascript_class_name, :string
89
+ t.column :shortcut_id, :string
90
+ t.column :base_url, :string
91
+ t.column :type, :string
92
+
93
+ t.timestamps
94
+ end
95
+ end
96
+
97
+ unless table_exists?(:app_containers_applications)
98
+ create_table :app_containers_applications, {:id => false} do |t|
99
+ t.column :app_container_id, :integer
100
+ t.column :application_id, :integer
101
+ end
102
+
103
+ add_index :app_containers_applications, :application_id
104
+ add_index :app_containers_applications, :app_container_id
105
+ end
106
+
107
+ unless table_exists?(:widgets)
108
+ create_table :widgets do |t|
109
+ t.column :description, :string
110
+ t.column :internal_identifier, :string
111
+ t.column :icon, :string
112
+ t.column :xtype, :string
113
+
114
+ t.timestamps
115
+ end
116
+ end
117
+
118
+ unless table_exists?(:applications_widgets)
119
+ create_table :applications_widgets, {:id => false} do |t|
120
+ t.column :application_id, :integer
121
+ t.column :widget_id, :integer
122
+ end
123
+ add_index :applications_widgets, :application_id
124
+ add_index :applications_widgets, :widget_id
125
+ end
126
+
127
+ unless table_exists?(:tree_menu_node_defs)
128
+ create_table :tree_menu_node_defs do |t|
129
+ t.string :node_type
130
+ t.integer :parent_id
131
+ t.integer :lft
132
+ t.integer :rgt
133
+ t.string :menu_short_name
134
+ t.string :menu_description
135
+ t.string :text
136
+ t.string :icon_url
137
+ t.string :target_url
138
+ t.string :resource_class
139
+ t.timestamps
140
+ end
141
+ add_index :tree_menu_node_defs, :parent_id
142
+ end
143
+
144
+ unless table_exists? :configurations
145
+ create_table :configurations do |t|
146
+ #custom columns go here
147
+ t.string :description
148
+ t.string :internal_identifier
149
+ t.boolean :active
150
+ t.boolean :is_template, :default => false
151
+
152
+ t.timestamps
153
+ end
154
+
155
+ add_index :configurations, :is_template
156
+ end
157
+
158
+ unless table_exists? :valid_configurations
159
+ create_table :valid_configurations do |t|
160
+ #foreign keys
161
+ t.references :configured_item, :polymorphic => true
162
+ t.references :configuration
163
+
164
+ t.timestamps
165
+ end
166
+
167
+ add_index :valid_configurations, [:configured_item_id, :configured_item_type], :name => 'configured_item_poly_idx'
168
+ add_index :valid_configurations, :configuration_id
169
+ end
170
+
171
+ unless table_exists? :configuration_items
172
+ create_table :configuration_items do |t|
173
+ #foreign keys
174
+ t.references :configuration
175
+ t.references :configuration_item_type
176
+ t.references :configuration_option
177
+
178
+ t.timestamps
179
+ end
180
+
181
+ add_index :configuration_items, :configuration_id
182
+ add_index :configuration_items, :configuration_item_type_id
183
+ add_index :configuration_items, :configuration_option_id
184
+ end
185
+
186
+ unless table_exists? :configuration_item_types
187
+ create_table :configuration_item_types do |t|
188
+ #awesome nested set columns
189
+ t.integer :parent_id
190
+ t.integer :lft
191
+ t.integer :rgt
192
+
193
+ #custom columns go here
194
+ t.string :description
195
+ t.string :internal_identifier
196
+ t.boolean :allow_user_defined_options, :default => false
197
+ t.boolean :is_multi_optional, :default => false
198
+
199
+ t.timestamps
200
+ end
201
+ end
202
+
203
+ unless table_exists?(:configuration_item_types_configurations)
204
+ create_table :configuration_item_types_configurations, {:id => false} do |t|
205
+ t.references :configuration_item_type
206
+ t.references :configuration
207
+ end
208
+
209
+ add_index :configuration_item_types_configurations, :configuration_item_type_id, :name => 'conf_conf_type_id_item_idx'
210
+ add_index :configuration_item_types_configurations, :configuration_id, :name => 'conf_id_idx'
211
+ add_index :configuration_item_types_configurations, [:configuration_item_type_id, :configuration_id], :unique => true, :name => 'conf_config_type_uniq_idx'
212
+ end
213
+
214
+ unless table_exists? :configuration_options
215
+ create_table :configuration_options do |t|
216
+ #custom columns go here
217
+ t.string :description
218
+ t.string :internal_identifier
219
+ t.string :value
220
+ t.text :comment
221
+ t.boolean :user_defined, :default => false
222
+
223
+ t.timestamps
224
+ end
225
+
226
+ add_index :configuration_options, :value
227
+ add_index :configuration_options, :internal_identifier
228
+ add_index :configuration_options, :user_defined
229
+ end
230
+
231
+ unless table_exists?(:configuration_item_types_configuration_options)
232
+ create_table :configuration_item_types_configuration_options do |t|
233
+ t.references :configuration_item_type
234
+ t.references :configuration_option
235
+ t.boolean :is_default, :default => false
236
+
237
+ t.timestamps
238
+ end
239
+
240
+ add_index :configuration_item_types_configuration_options, :configuration_item_type_id, :name => 'conf_item_type_conf_opt_id_item_idx'
241
+ add_index :configuration_item_types_configuration_options, :configuration_option_id, :name => 'conf_item_type_conf_opt_id_opt_idx'
242
+ end
243
+
244
+ unless table_exists?(:configuration_items_configuration_options)
245
+ create_table :configuration_items_configuration_options, {:id => false} do |t|
246
+ t.references :configuration_item
247
+ t.references :configuration_option
248
+ end
249
+
250
+ add_index :configuration_items_configuration_options, :configuration_item_id, :name => 'conf_item_conf_opt_id_item_idx'
251
+ add_index :configuration_items_configuration_options, :configuration_option_id, :name => 'conf_item_conf_opt_id_opt_idx'
252
+ end
253
+
254
+ end
255
+
256
+ def self.down
257
+ [
258
+ :preferences, :preference_types,
259
+ :preference_options, :preference_options_preference_types,
260
+ :valid_preference_types, :user_preferences,
261
+ :app_containers, :app_containers_applications,
262
+ :applications_widgets, :widgets, :tree_menu_node_defs,
263
+ :applications, :applications_desktops,
264
+ :configurations, :configuration_items,
265
+ :configuration_item_types, :configuration_options,
266
+ :configuration_item_types_configuration_options,
267
+ :configuration_items_configuration_options, :configured_items,
268
+ :configuration_item_types_configurations
269
+ ].each do |tbl|
270
+ if table_exists?(tbl)
271
+ drop_table(tbl)
272
+ end
273
+ end
274
+ end
275
+
276
+ end
@@ -0,0 +1,95 @@
1
+ # This migration comes from erp_forms (originally 20110530193446)
2
+ class DynamicForms < ActiveRecord::Migration
3
+ def self.up
4
+ unless table_exists?(:dynamic_form_models)
5
+ create_table :dynamic_form_models do |t|
6
+ t.string :model_name
7
+ t.boolean :show_in_multitask, :default => false
8
+ t.boolean :allow_comments, :default => true
9
+ t.boolean :allow_files, :default => true
10
+ t.string :file_security_default, :default => 'private'
11
+
12
+ t.timestamps
13
+ end
14
+ end
15
+
16
+ unless table_exists?(:dynamic_form_documents)
17
+ create_table :dynamic_form_documents do |t|
18
+ t.integer :dynamic_form_model_id
19
+ t.string :type
20
+
21
+ t.timestamps
22
+ end
23
+
24
+ add_index :dynamic_form_documents, :dynamic_form_model_id
25
+ add_index :dynamic_form_documents, :type
26
+ end
27
+
28
+ unless table_exists?(:dynamic_forms)
29
+ create_table :dynamic_forms do |t|
30
+ t.string :description
31
+ t.text :definition
32
+ t.integer :dynamic_form_model_id
33
+ t.string :model_name
34
+ t.string :internal_identifier
35
+ t.boolean :default
36
+ t.string :widget_action, :default => 'save'
37
+ t.string :widget_email_recipients
38
+ t.boolean :focus_first_field, :default => true
39
+ t.boolean :submit_empty_text, :default => false
40
+ t.string :msg_target, :default => 'qtip'
41
+ t.string :submit_button_label, :default => 'Submit'
42
+ t.string :cancel_button_label, :default => 'Cancel'
43
+ t.text :comment
44
+
45
+ t.integer :created_by_id
46
+ t.integer :updated_by_id
47
+
48
+ t.timestamps
49
+ end
50
+
51
+ add_index :dynamic_forms, :created_by_id
52
+ add_index :dynamic_forms, :updated_by_id
53
+ add_index :dynamic_forms, :dynamic_form_model_id
54
+ add_index :dynamic_forms, :model_name
55
+ add_index :dynamic_forms, :internal_identifier
56
+ end
57
+
58
+ unless table_exists?(:dynamic_data)
59
+ create_table :dynamic_data do |t|
60
+ t.string :reference_type
61
+ t.integer :reference_id
62
+ t.text :dynamic_attributes
63
+
64
+ t.integer :created_with_form_id
65
+ t.integer :updated_with_form_id
66
+
67
+ t.integer :created_by_id
68
+ t.integer :updated_by_id
69
+
70
+ t.timestamps
71
+ end
72
+
73
+ add_index :dynamic_data, :created_with_form_id
74
+ add_index :dynamic_data, :updated_with_form_id
75
+ add_index :dynamic_data, :created_by_id
76
+ add_index :dynamic_data, :updated_by_id
77
+ add_index :dynamic_data, :reference_type
78
+ add_index :dynamic_data, :reference_id
79
+ end
80
+
81
+ end
82
+
83
+ def self.down
84
+ [ :dynamic_form_models,
85
+ :dynamic_form_documents,
86
+ :dynamic_forms,
87
+ :dynamic_data
88
+ ].each do |tbl|
89
+ if table_exists?(tbl)
90
+ drop_table tbl
91
+ end
92
+ end
93
+
94
+ end
95
+ end
@@ -0,0 +1,19 @@
1
+ # This migration comes from erp_forms (originally 20120824012520)
2
+ class CreateTickets < ActiveRecord::Migration
3
+
4
+ def up
5
+ unless table_exists?(:tickets)
6
+ create_table :tickets do |t|
7
+ t.timestamps
8
+ end
9
+ end
10
+
11
+ end
12
+
13
+ def down
14
+ if table_exists?(:tickets)
15
+ drop_table :tickets
16
+ end
17
+ end
18
+
19
+ end
@@ -0,0 +1,32 @@
1
+ # This migration comes from erp_forms (originally 20121007022323)
2
+ class UpgradeDynamicFormsTable < ActiveRecord::Migration
3
+ def self.up
4
+ add_column :dynamic_form_models, :show_in_multitask, :boolean, :default => false unless columns(:dynamic_form_models).collect {|c| c.name}.include?('show_in_multitask')
5
+ add_column :dynamic_form_models, :allow_comments, :boolean, :default => true unless columns(:dynamic_form_models).collect {|c| c.name}.include?('allow_comments')
6
+ add_column :dynamic_form_models, :allow_files, :boolean, :default => true unless columns(:dynamic_form_models).collect {|c| c.name}.include?('allow_files')
7
+ add_column :dynamic_form_models, :file_security_default, :string, :default => 'private' unless columns(:dynamic_form_models).collect {|c| c.name}.include?('file_security_default')
8
+ add_column :dynamic_forms, :widget_action, :string, :default => 'save' unless columns(:dynamic_forms).collect {|c| c.name}.include?('widget_action')
9
+ add_column :dynamic_forms, :widget_email_recipients, :string unless columns(:dynamic_forms).collect {|c| c.name}.include?('widget_email_recipients')
10
+ add_column :dynamic_forms, :focus_first_field, :boolean, :default => true unless columns(:dynamic_forms).collect {|c| c.name}.include?('focus_first_field')
11
+ add_column :dynamic_forms, :submit_empty_text, :boolean, :default => false unless columns(:dynamic_forms).collect {|c| c.name}.include?('submit_empty_text')
12
+ add_column :dynamic_forms, :msg_target, :string, :default => 'qtip' unless columns(:dynamic_forms).collect {|c| c.name}.include?('msg_target')
13
+ add_column :dynamic_forms, :submit_button_label, :string, :default => 'Submit' unless columns(:dynamic_forms).collect {|c| c.name}.include?('submit_button_label')
14
+ add_column :dynamic_forms, :cancel_button_label, :string, :default => 'Cancel' unless columns(:dynamic_forms).collect {|c| c.name}.include?('cancel_button_label')
15
+ add_column :dynamic_forms, :comment, :text unless columns(:dynamic_forms).collect {|c| c.name}.include?('comment')
16
+ end
17
+
18
+ def self.down
19
+ remove_column :dynamic_form_models, :show_in_multitask if columns(:dynamic_form_models).collect {|c| c.name}.include?('show_in_multitask')
20
+ remove_column :dynamic_form_models, :file_security_default if columns(:dynamic_form_models).collect {|c| c.name}.include?('file_security_default')
21
+ remove_column :dynamic_form_models, :allow_files if columns(:dynamic_form_models).collect {|c| c.name}.include?('allow_files')
22
+ remove_column :dynamic_form_models, :allow_comments if columns(:dynamic_form_models).collect {|c| c.name}.include?('allow_comments')
23
+ remove_column :dynamic_forms, :widget_action if columns(:dynamic_forms).collect {|c| c.name}.include?('widget_action')
24
+ remove_column :dynamic_forms, :widget_email_recipients if columns(:dynamic_forms).collect {|c| c.name}.include?('widget_email_recipients')
25
+ remove_column :dynamic_forms, :focus_first_field if columns(:dynamic_forms).collect {|c| c.name}.include?('focus_first_field')
26
+ remove_column :dynamic_forms, :submit_empty_text if columns(:dynamic_forms).collect {|c| c.name}.include?('submit_empty_text')
27
+ remove_column :dynamic_forms, :msg_target if columns(:dynamic_forms).collect {|c| c.name}.include?('msg_target')
28
+ remove_column :dynamic_forms, :submit_button_label if columns(:dynamic_forms).collect {|c| c.name}.include?('submit_button_label')
29
+ remove_column :dynamic_forms, :cancel_button_label if columns(:dynamic_forms).collect {|c| c.name}.include?('cancel_button_label')
30
+ remove_column :dynamic_forms, :comment if columns(:dynamic_forms).collect {|c| c.name}.include?('comment')
31
+ end
32
+ end
@@ -0,0 +1,316 @@
1
+ # This migration comes from knitkit (originally 20110211002317)
2
+ class SetupKnitkit < ActiveRecord::Migration
3
+ def self.up
4
+
5
+ unless table_exists?(:websites)
6
+ create_table :websites do |t|
7
+ t.string :name
8
+ t.string :title
9
+ t.string :subtitle
10
+ t.string :internal_identifier
11
+ t.string :email
12
+ t.boolean :auto_activate_publication
13
+ t.boolean :email_inquiries
14
+
15
+ t.timestamps
16
+ end
17
+ end
18
+
19
+ unless table_exists?(:website_hosts)
20
+ create_table :website_hosts do |t|
21
+ t.references :website
22
+ t.string :host
23
+
24
+ t.timestamps
25
+ end
26
+
27
+ add_index :website_hosts, :website_id
28
+ end
29
+
30
+ unless table_exists?(:website_inquiries)
31
+ create_table :website_inquiries do |t|
32
+ t.integer :website_id
33
+
34
+ t.timestamps
35
+ end
36
+
37
+ add_index :website_inquiries, :website_id
38
+ end
39
+
40
+ unless table_exists?(:website_sections)
41
+ create_table :website_sections do |t|
42
+ t.string :title
43
+ t.string :type
44
+ t.references :website
45
+ t.string :path
46
+ t.string :permalink
47
+ t.text :layout
48
+ t.boolean :in_menu
49
+ t.integer :position, :default => 0
50
+ t.string :internal_identifier
51
+ t.integer :version
52
+ t.boolean :render_base_layout, :default => true
53
+
54
+ #better nested set columns
55
+ t.integer :parent_id
56
+ t.integer :lft
57
+ t.integer :rgt
58
+
59
+ t.timestamps
60
+ end
61
+ #indexes
62
+ add_index :website_sections, :permalink
63
+ add_index :website_sections, :website_id
64
+ add_index :website_sections, :position
65
+ add_index :website_sections, :parent_id
66
+ add_index :website_sections, :lft
67
+ add_index :website_sections, :rgt
68
+ add_index :website_sections, :version
69
+ add_index :website_sections, :internal_identifier, :name => 'section_iid_idx'
70
+
71
+ WebsiteSection.create_versioned_table
72
+ end
73
+
74
+ unless table_exists?(:contents)
75
+ create_table :contents do |t|
76
+ t.string :type
77
+ t.string :title
78
+ t.string :permalink
79
+ t.text :excerpt_html
80
+ t.text :body_html
81
+ t.integer :created_by_id
82
+ t.integer :updated_by_id
83
+ t.string :internal_identifier
84
+ t.boolean :display_title
85
+ t.integer :version
86
+
87
+ t.timestamps
88
+ end
89
+ #indexes
90
+ add_index :contents, :type
91
+ add_index :contents, :created_by_id
92
+ add_index :contents, :updated_by_id
93
+ add_index :contents, :permalink
94
+ add_index :contents, :version
95
+ add_index :contents, :internal_identifier, :name => 'contents_iid_idx'
96
+
97
+ Content.create_versioned_table
98
+ end
99
+
100
+ unless table_exists?(:website_section_contents)
101
+ create_table :website_section_contents do |t|
102
+ t.integer :website_section_id
103
+ t.integer :content_id
104
+ t.string :content_area
105
+ t.integer :position, :default => 0
106
+
107
+ t.timestamps
108
+ end
109
+ #indexes
110
+ add_index :website_section_contents, :website_section_id
111
+ add_index :website_section_contents, :content_id
112
+ add_index :website_section_contents, :position
113
+ add_index :website_section_contents, :content_area
114
+ end
115
+
116
+ unless table_exists?(:themes)
117
+ create_table :themes do |t|
118
+ t.references :website
119
+ t.string :name
120
+ t.string :theme_id
121
+ t.string :author
122
+ t.integer :version
123
+ t.string :homepage
124
+ t.text :summary
125
+ t.integer :active
126
+
127
+ t.timestamps
128
+ end
129
+ #indexes
130
+ add_index :themes, :website_id
131
+ add_index :themes, :active
132
+ end
133
+
134
+ unless table_exists?(:published_websites)
135
+ create_table :published_websites do |t|
136
+ t.references :website
137
+ t.text :comment
138
+ t.decimal :version, :precision => 18, :scale => 6
139
+ t.boolean :active
140
+ t.integer :published_by_id
141
+
142
+ t.timestamps
143
+ end
144
+
145
+ #indexes
146
+ add_index :published_websites, :website_id
147
+ add_index :published_websites, :version
148
+ add_index :published_websites, :active
149
+ add_index :published_websites, :published_by_id
150
+ end
151
+
152
+ unless table_exists?(:published_elements)
153
+ create_table :published_elements do |t|
154
+ t.references :published_website
155
+ t.references :published_element_record, :polymorphic => true
156
+ t.integer :version
157
+ t.integer :published_by_id
158
+
159
+ t.timestamps
160
+ end
161
+
162
+ #indexes
163
+ add_index :published_elements, [:published_element_record_id, :published_element_record_type], :name => 'published_elm_idx'
164
+ add_index :published_elements, :published_website_id
165
+ add_index :published_elements, :version
166
+ add_index :published_elements, :published_by_id
167
+ end
168
+
169
+ unless table_exists?(:comments)
170
+ create_table :comments do |t|
171
+ t.string :commentor_name
172
+ t.string :email
173
+ t.text :comment
174
+ t.integer :approved
175
+ t.datetime :approved_at
176
+ t.references :user
177
+ t.references :commented_record, :polymorphic => true
178
+
179
+ t.timestamps
180
+ end
181
+
182
+ add_index :comments, [:commented_record_id, :commented_record_type], :name => 'commented_record_idx'
183
+ add_index :comments, [:approved]
184
+ add_index :comments, [:user_id]
185
+ end
186
+
187
+ unless table_exists?(:website_nav_items)
188
+ create_table :website_nav_items do |t|
189
+ t.references :website_nav
190
+ t.string :title
191
+ t.string :url
192
+ t.integer :position, :default => 0
193
+ t.references :linked_to_item, :polymorphic => true
194
+
195
+ #better nested set columns
196
+ t.integer :parent_id
197
+ t.integer :lft
198
+ t.integer :rgt
199
+
200
+ t.timestamps
201
+ end
202
+
203
+ add_index :website_nav_items, [:linked_to_item_id, :linked_to_item_type], :name => 'linked_to_idx'
204
+ add_index :website_nav_items, :website_nav_id
205
+ add_index :website_nav_items, :position
206
+ add_index :website_nav_items, :parent_id
207
+ add_index :website_nav_items, :lft
208
+ add_index :website_nav_items, :rgt
209
+ end
210
+
211
+ unless table_exists?(:website_navs)
212
+ create_table :website_navs do |t|
213
+ t.references :website
214
+ t.string :name
215
+
216
+ t.timestamps
217
+ end
218
+
219
+ add_index :website_navs, :website_id
220
+ end
221
+
222
+ unless table_exists?(:tags)
223
+ create_table :tags do |t|
224
+ t.column :name, :string
225
+ end
226
+ end
227
+
228
+ unless table_exists?(:taggings)
229
+ create_table :taggings do |t|
230
+ t.column :tag_id, :integer
231
+ t.column :taggable_id, :integer
232
+ t.column :tagger_id, :integer
233
+ t.column :tagger_type, :string
234
+
235
+ # You should make sure that the column created is
236
+ # long enough to store the required class names.
237
+ t.column :taggable_type, :string
238
+ t.column :context, :string
239
+
240
+ t.column :created_at, :datetime
241
+ end
242
+
243
+ add_index :taggings, :tag_id
244
+ add_index :taggings, [:taggable_id, :taggable_type, :context], :name => 'taggable_poly_idx'
245
+ end
246
+
247
+ unless table_exists? :website_party_roles
248
+ create_table :website_party_roles do |t|
249
+ #foreign keys
250
+ t.references :website
251
+ t.references :role_type
252
+ t.references :party
253
+
254
+ t.timestamps
255
+ end
256
+
257
+ add_index :website_party_roles, :website_id
258
+ add_index :website_party_roles, :role_type_id
259
+ add_index :website_party_roles, :party_id
260
+ end
261
+
262
+ create_table :documented_items, :force => true do |t|
263
+ t.string :documented_klass, :null => true
264
+ t.integer :documented_content_id, :null => true
265
+ t.integer :online_document_section_id
266
+ t.timestamps
267
+ end
268
+
269
+ create_table :documents do |t|
270
+ t.string :external_identifier
271
+ t.string :internal_identifier
272
+ t.string :description
273
+ t.datetime :document_date
274
+ t.text :dynamic_attributes
275
+
276
+ t.references :document_record, :polymorphic => true
277
+ t.references :document_type
278
+
279
+ t.timestamps
280
+ end
281
+
282
+ add_index :documents, [:document_record_type, :document_record_id], :name => 'document_record_poly_idx'
283
+ add_index :documents, :document_type_id, :name => 'document_type_idx'
284
+
285
+ create_table :document_types do |t|
286
+ t.string :external_identifier
287
+ t.string :internal_identifier
288
+ t.string :description
289
+
290
+ t.timestamps
291
+ end
292
+
293
+ create_table :valid_documents do |t|
294
+ t.references :document
295
+ t.references :documented_model, :polymorphic => true
296
+ end
297
+
298
+ add_index :valid_documents, :document_id
299
+ add_index :valid_documents, [:documented_model_id, :documented_model_type], :name => 'valid_documents_model_idx'
300
+
301
+ end
302
+
303
+ def self.down
304
+ WebsiteSection.drop_versioned_table
305
+ Content.drop_versioned_table
306
+
307
+ # check that each table exists before trying to delete it.
308
+ [:websites, :website_sections, :contents, :website_section_contents, :documents, :document_types, :valid_documents,
309
+ :themes, :theme_files, :published_websites, :published_elements, :website_party_roles,
310
+ :comments,:website_hosts,:website_nav_items, :website_navs, :tags, :taggings, :documented_items].each do |tbl|
311
+ if table_exists?(tbl)
312
+ drop_table tbl
313
+ end
314
+ end
315
+ end
316
+ end