dm_forum 4.2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +23 -0
  3. data/README.md +33 -0
  4. data/Rakefile +30 -0
  5. data/app/assets/javascripts/dm_forum/admin.js +20 -0
  6. data/app/assets/javascripts/dm_forum/application.js +16 -0
  7. data/app/assets/javascripts/dm_forum/dm_forum.js +3 -0
  8. data/app/assets/stylesheets/dm_forum/admin.css +2 -0
  9. data/app/assets/stylesheets/dm_forum/application.css +12 -0
  10. data/app/controllers/dm_forum/admin/admin_controller.rb +13 -0
  11. data/app/controllers/dm_forum/admin/dashboard_controller.rb +12 -0
  12. data/app/controllers/dm_forum/admin/forum_categories_controller.rb +80 -0
  13. data/app/controllers/dm_forum/admin/forum_sites_controller.rb +40 -0
  14. data/app/controllers/dm_forum/admin/forums_controller.rb +113 -0
  15. data/app/controllers/dm_forum/application_controller.rb +25 -0
  16. data/app/controllers/dm_forum/forum_comments_controller.rb +88 -0
  17. data/app/controllers/dm_forum/forum_topics_controller.rb +93 -0
  18. data/app/controllers/dm_forum/forums_controller.rb +45 -0
  19. data/app/datatables/forum_user_datatable.rb +79 -0
  20. data/app/helpers/dm_forum/application_helper.rb +5 -0
  21. data/app/helpers/dm_forum/forum_helper.rb +109 -0
  22. data/app/mailers/forum_notification_mailer.rb +27 -0
  23. data/app/models/dm_forum/concerns/ability.rb +50 -0
  24. data/app/models/dm_forum/concerns/user.rb +37 -0
  25. data/app/models/dm_forum/permitted_params.rb +38 -0
  26. data/app/models/forum.rb +74 -0
  27. data/app/models/forum_category.rb +14 -0
  28. data/app/models/forum_comment.rb +93 -0
  29. data/app/models/forum_site.rb +27 -0
  30. data/app/models/forum_topic.rb +146 -0
  31. data/app/presenters/forum_comment_presenter.rb +8 -0
  32. data/app/presenters/forum_common_presenter.rb +31 -0
  33. data/app/presenters/forum_presenter.rb +14 -0
  34. data/app/views/dm_forum/admin/dashboard/_widget_forum_comments.html.erb +38 -0
  35. data/app/views/dm_forum/admin/dashboard/widget_forum_comments.js.erb +1 -0
  36. data/app/views/dm_forum/admin/forum_categories/_content_toolbar.html.erb +5 -0
  37. data/app/views/dm_forum/admin/forum_categories/_form.html.erb +18 -0
  38. data/app/views/dm_forum/admin/forum_categories/edit.html.erb +3 -0
  39. data/app/views/dm_forum/admin/forum_categories/index.html.erb +25 -0
  40. data/app/views/dm_forum/admin/forum_categories/new.html.erb +3 -0
  41. data/app/views/dm_forum/admin/forum_categories/show.html.erb +41 -0
  42. data/app/views/dm_forum/admin/forum_sites/_form.html.erb +18 -0
  43. data/app/views/dm_forum/admin/forum_sites/edit.html.erb +2 -0
  44. data/app/views/dm_forum/admin/forum_sites/show.html.erb +12 -0
  45. data/app/views/dm_forum/admin/forums/_content_toolbar.html.erb +5 -0
  46. data/app/views/dm_forum/admin/forums/_form.html.erb +24 -0
  47. data/app/views/dm_forum/admin/forums/edit.html.erb +2 -0
  48. data/app/views/dm_forum/admin/forums/new.html.erb +2 -0
  49. data/app/views/dm_forum/admin/forums/show.html.erb +68 -0
  50. data/app/views/dm_forum/forum_comments/_formatting.html.erb +12 -0
  51. data/app/views/dm_forum/forum_comments/edit.html.erb +15 -0
  52. data/app/views/dm_forum/forum_topics/_comment_item.html.erb +26 -0
  53. data/app/views/dm_forum/forum_topics/_comments_list.html.erb +63 -0
  54. data/app/views/dm_forum/forum_topics/_follow_button.html.erb +3 -0
  55. data/app/views/dm_forum/forum_topics/_form.html.erb +24 -0
  56. data/app/views/dm_forum/forum_topics/edit.html.erb +13 -0
  57. data/app/views/dm_forum/forum_topics/new.html.erb +13 -0
  58. data/app/views/dm_forum/forum_topics/show.html.erb +49 -0
  59. data/app/views/dm_forum/forum_topics/toggle_follow.js.coffee +5 -0
  60. data/app/views/dm_forum/forums/_category_side_list.html.erb +28 -0
  61. data/app/views/dm_forum/forums/_forum_header.html.erb +14 -0
  62. data/app/views/dm_forum/forums/_no_forums.html.erb +1 -0
  63. data/app/views/dm_forum/forums/_topics_list.html.erb +86 -0
  64. data/app/views/dm_forum/forums/categories.html.erb +32 -0
  65. data/app/views/dm_forum/forums/list.html.erb +10 -0
  66. data/app/views/dm_forum/forums/show.html.erb +39 -0
  67. data/app/views/layouts/email_templates/forum_notification.html.erb +15 -0
  68. data/app/views/layouts/email_templates/forum_notification.text.erb +16 -0
  69. data/config/initializers/dm_forum.rb +0 -0
  70. data/config/locales/fms.cs.yml +104 -0
  71. data/config/locales/fms.de.yml +104 -0
  72. data/config/locales/fms.en.yml +104 -0
  73. data/config/locales/fms.fi.yml +104 -0
  74. data/config/locales/fms.ja.yml +104 -0
  75. data/config/routes.rb +43 -0
  76. data/db/migrate/20130103151149_create_forums.rb +72 -0
  77. data/db/migrate/20130424125513_add_public_forum.rb +13 -0
  78. data/db/migrate/20130430084925_add_forum_category.rb +7 -0
  79. data/db/migrate/20140201112134_delete_monitorships.rb +17 -0
  80. data/db/migrate/20140303121325_add_requires_subscription_forum.rb +5 -0
  81. data/db/migrate/20140423113420_add_forum_owner.rb +6 -0
  82. data/db/migrate/20160821150125_index_foreign_keys_in_fms_forum_sites.rb +5 -0
  83. data/db/migrate/20160821150126_index_foreign_keys_in_fms_forum_topics.rb +9 -0
  84. data/db/migrate/20160821150127_index_foreign_keys_in_fms_forums.rb +7 -0
  85. data/lib/dm_forum/engine.rb +9 -0
  86. data/lib/dm_forum/version.rb +3 -0
  87. data/lib/dm_forum.rb +4 -0
  88. data/lib/tasks/dm_forum_tasks.rake +4 -0
  89. data/spec/dummy/README.rdoc +28 -0
  90. data/spec/dummy/Rakefile +6 -0
  91. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  92. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  93. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  94. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  95. data/spec/dummy/app/models/ability.rb +12 -0
  96. data/spec/dummy/app/models/user.rb +6 -0
  97. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  98. data/spec/dummy/bin/bundle +3 -0
  99. data/spec/dummy/bin/rails +4 -0
  100. data/spec/dummy/bin/rake +4 -0
  101. data/spec/dummy/config/application.rb +26 -0
  102. data/spec/dummy/config/boot.rb +5 -0
  103. data/spec/dummy/config/database.yml +25 -0
  104. data/spec/dummy/config/environment.rb +5 -0
  105. data/spec/dummy/config/environments/development.rb +37 -0
  106. data/spec/dummy/config/environments/production.rb +82 -0
  107. data/spec/dummy/config/environments/test.rb +39 -0
  108. data/spec/dummy/config/initializers/assets.rb +8 -0
  109. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  110. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  111. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  112. data/spec/dummy/config/initializers/inflections.rb +16 -0
  113. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  114. data/spec/dummy/config/initializers/session_store.rb +3 -0
  115. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  116. data/spec/dummy/config/locales/en.yml +23 -0
  117. data/spec/dummy/config/routes.rb +17 -0
  118. data/spec/dummy/config/secrets.yml +22 -0
  119. data/spec/dummy/config.ru +4 -0
  120. data/spec/dummy/db/development.sqlite3 +0 -0
  121. data/spec/dummy/db/migrate/20141114170927_add_globalize_countries.dm_core.rb +50 -0
  122. data/spec/dummy/db/migrate/20141114170928_devise_create_users.dm_core.rb +46 -0
  123. data/spec/dummy/db/migrate/20141114170929_add_user_fields.dm_core.rb +14 -0
  124. data/spec/dummy/db/migrate/20141114170930_rolify_create_roles.dm_core.rb +20 -0
  125. data/spec/dummy/db/migrate/20141114170931_add_last_access.dm_core.rb +10 -0
  126. data/spec/dummy/db/migrate/20141114170932_create_versions.dm_core.rb +19 -0
  127. data/spec/dummy/db/migrate/20141114170933_add_object_changes_column_to_versions.dm_core.rb +12 -0
  128. data/spec/dummy/db/migrate/20141114170934_create_dm_core_accounts.dm_core.rb +13 -0
  129. data/spec/dummy/db/migrate/20141114170935_add_account_to_users.dm_core.rb +9 -0
  130. data/spec/dummy/db/migrate/20141114170936_create_preferences.dm_core.rb +13 -0
  131. data/spec/dummy/db/migrate/20141114170937_create_comments.dm_core.rb +22 -0
  132. data/spec/dummy/db/migrate/20141114170938_add_activity.dm_core.rb +21 -0
  133. data/spec/dummy/db/migrate/20141114170939_add_type_to_comments.dm_core.rb +9 -0
  134. data/spec/dummy/db/migrate/20141114170940_add_category.dm_core.rb +28 -0
  135. data/spec/dummy/db/migrate/20141114170941_create_email_table.dm_core.rb +26 -0
  136. data/spec/dummy/db/migrate/20141114170942_add_user_profile.dm_core.rb +46 -0
  137. data/spec/dummy/db/migrate/20141114170943_add_profile_email.dm_core.rb +14 -0
  138. data/spec/dummy/db/migrate/20141114170944_create_payment_history.dm_core.rb +37 -0
  139. data/spec/dummy/db/migrate/20141114170945_change_anchor_field.dm_core.rb +10 -0
  140. data/spec/dummy/db/migrate/20141114170946_create_user_site_profile.dm_core.rb +27 -0
  141. data/spec/dummy/db/migrate/20141114170947_add_avatar.dm_core.rb +12 -0
  142. data/spec/dummy/db/migrate/20141114170948_add_notify_to_payment_history.dm_core.rb +8 -0
  143. data/spec/dummy/db/migrate/20141114170949_acts_as_votable_migration.dm_core.rb +28 -0
  144. data/spec/dummy/db/migrate/20141114170950_add_user_site_profile_uuid.dm_core.rb +19 -0
  145. data/spec/dummy/db/migrate/20141114170951_add_invoice_id.dm_core.rb +7 -0
  146. data/spec/dummy/db/migrate/20141114170952_acts_as_follower_migration.dm_core.rb +18 -0
  147. data/spec/dummy/db/migrate/20141114170953_rename_invoice_id.dm_core.rb +12 -0
  148. data/spec/dummy/db/migrate/20141114170954_add_core_addresses.dm_core.rb +18 -0
  149. data/spec/dummy/db/migrate/20141114170955_papertrail_increase_column.dm_core.rb +9 -0
  150. data/spec/dummy/db/migrate/20141114170956_acts_as_taggable_on_migration.dm_core.rb +32 -0
  151. data/spec/dummy/db/migrate/20141114170957_add_missing_unique_indices.dm_core.rb +23 -0
  152. data/spec/dummy/db/migrate/20141114170958_add_taggings_counter_cache_to_tags.dm_core.rb +16 -0
  153. data/spec/dummy/db/migrate/20141114170959_create_custom_fields.dm_core.rb +40 -0
  154. data/spec/dummy/db/migrate/20141114170960_add_missing_taggable_index.dm_core.rb +11 -0
  155. data/spec/dummy/db/migrate/20141119112030_create_cms.dm_cms.rb +92 -0
  156. data/spec/dummy/db/migrate/20141119112031_add_account_to_cms.dm_cms.rb +11 -0
  157. data/spec/dummy/db/migrate/20141119112032_create_blog.dm_cms.rb +62 -0
  158. data/spec/dummy/db/migrate/20141119112033_add_notification_sent.dm_cms.rb +6 -0
  159. data/spec/dummy/db/migrate/20141119112034_add_blog_comment.dm_cms.rb +8 -0
  160. data/spec/dummy/db/migrate/20141119112035_add_blog_image.dm_cms.rb +6 -0
  161. data/spec/dummy/db/migrate/20141119112036_rename_snippet_slug.dm_cms.rb +14 -0
  162. data/spec/dummy/db/migrate/20141119112037_add_requires_subscription_blog.dm_cms.rb +8 -0
  163. data/spec/dummy/db/migrate/20141119112038_add_pages_ranked_model.dm_cms.rb +23 -0
  164. data/spec/dummy/db/migrate/20141119112039_add_blog_owner.dm_cms.rb +7 -0
  165. data/spec/dummy/db/migrate/20141119112040_create_media_files.dm_cms.rb +30 -0
  166. data/spec/dummy/db/migrate/20141119112041_add_cmspage_summary.dm_cms.rb +7 -0
  167. data/spec/dummy/db/migrate/20141119112042_add_blog_image_email_header.dm_cms.rb +6 -0
  168. data/spec/dummy/db/migrate/20141119112043_add_header_image.dm_cms.rb +10 -0
  169. data/spec/dummy/db/migrate/20160128144312_add_favored_locale.dm_core.rb +17 -0
  170. data/spec/dummy/db/migrate/20160128144313_update_papertrail_v4.dm_core.rb +41 -0
  171. data/spec/dummy/db/schema.rb +628 -0
  172. data/spec/dummy/public/404.html +67 -0
  173. data/spec/dummy/public/422.html +67 -0
  174. data/spec/dummy/public/500.html +66 -0
  175. data/spec/dummy/public/favicon.ico +0 -0
  176. data/spec/factories/accounts.rb +9 -0
  177. data/spec/factories/user_profiles.rb +10 -0
  178. data/spec/factories/users.rb +19 -0
  179. data/spec/models/forum_spec.rb +9 -0
  180. data/spec/rails_helper.rb +70 -0
  181. data/spec/spec_helper.rb +85 -0
  182. data/spec/support/accounts.rb +17 -0
  183. data/spec/support/devise.rb +44 -0
  184. data/spec/support/fix_locale.rb +57 -0
  185. metadata +337 -0
@@ -0,0 +1,28 @@
1
+ # This migration comes from dm_core (originally 20130429191051)
2
+ class AddCategory < ActiveRecord::Migration
3
+ def up
4
+ create_table "core_category_translations", :force => true do |t|
5
+ t.integer :core_category_id
6
+ t.string :locale
7
+ t.string :name
8
+ t.string :description
9
+ t.datetime :created_at
10
+ t.datetime :updated_at
11
+ end
12
+
13
+ add_index "core_category_translations", ["core_category_id"], :name => "index_category_translation"
14
+
15
+ create_table "core_categories", :force => true do |t|
16
+ t.string :type
17
+ t.integer :row_order
18
+ t.integer :account_id
19
+ t.datetime :created_on
20
+ t.datetime :updated_on
21
+ end
22
+ end
23
+
24
+ def down
25
+ drop_table :core_categories
26
+ drop_table :core_category_translations
27
+ end
28
+ end
@@ -0,0 +1,26 @@
1
+ # This migration comes from dm_core (originally 20130513112751)
2
+ class CreateEmailTable < ActiveRecord::Migration
3
+ def up
4
+ create_table :core_system_email_translations, :force => true do |t|
5
+ t.integer :core_system_email_id
6
+ t.string :locale
7
+ t.string :subject
8
+ t.text :body
9
+ t.datetime :created_at
10
+ t.datetime :updated_at
11
+ end
12
+
13
+ create_table :core_system_emails, :force => true do |t|
14
+ t.string :email_type
15
+ t.references :emailable, :polymorphic => true
16
+ t.datetime :created_at
17
+ t.datetime :updated_at
18
+ t.integer :account_id
19
+ end
20
+ end
21
+
22
+ def down
23
+ drop_table :core_system_emails
24
+ drop_table :core_system_email_translations
25
+ end
26
+ end
@@ -0,0 +1,46 @@
1
+ # This migration comes from dm_core (originally 20130516143539)
2
+ class AddUserProfile < ActiveRecord::Migration
3
+ def up
4
+ create_table :user_profiles, :force => true do |t|
5
+ t.integer :user_id
6
+ t.string :public_name, :limit => 50, :default => ""
7
+ t.string :first_name, :limit => 50, :default => ""
8
+ t.string :last_name, :limit => 50, :default => ""
9
+ t.string :address, :limit => 70, :default => ""
10
+ t.string :address2, :limit => 70, :default => ""
11
+ t.string :city, :limit => 30, :default => ""
12
+ t.string :state, :limit => 30, :default => ""
13
+ t.string :zipcode, :limit => 10, :default => ""
14
+ t.integer :country_id, :default => 0
15
+ t.string :phone, :limit => 20, :default => ""
16
+ t.string :cell, :limit => 20, :default => ""
17
+ t.string :fax, :limit => 20, :default => ""
18
+ t.string :workphone, :limit => 20, :default => ""
19
+ t.string :website, :limit => 50, :default => ""
20
+ t.string :gender, :limit => 1, :default => ""
21
+ t.integer :status, :default => 0
22
+ t.integer :lock_version, :default => 0
23
+ t.datetime :last_access_at
24
+ t.datetime :created_at
25
+ t.datetime :updated_at
26
+ t.integer :account_id
27
+ end
28
+
29
+ User.all.find_each do |user|
30
+ Account.current = Account.find(user.account_id)
31
+ p = user.create_user_profile
32
+ p.update_attributes(first_name: user.attributes['first_name'], last_name: user.attributes['last_name'],
33
+ country_id: user.attributes['country_id'],
34
+ public_name: "#{user.attributes['first_name']}")
35
+ p.update_attribute(:last_access_at, user.attributes['last_access_at'])
36
+ end
37
+ remove_column :users, :first_name
38
+ remove_column :users, :last_name
39
+ remove_column :users, :country_id
40
+ remove_column :users, :last_access_at
41
+ end
42
+
43
+ def down
44
+ drop_table :user_profiles
45
+ end
46
+ end
@@ -0,0 +1,14 @@
1
+ # This migration comes from dm_core (originally 20130518155712)
2
+ class AddProfileEmail < ActiveRecord::Migration
3
+ def up
4
+ add_column :user_profiles, :email, :string
5
+ User.all.find_each do |user|
6
+ Account.current = Account.find(user.account_id)
7
+ user.user_profile.update_attribute(:email, user.attributes['email'])
8
+ end
9
+ end
10
+
11
+ def down
12
+ remove_column :user_profiles, :email
13
+ end
14
+ end
@@ -0,0 +1,37 @@
1
+ # This migration comes from dm_core (originally 20130620145610)
2
+ class CreatePaymentHistory < ActiveRecord::Migration
3
+ def up
4
+ create_table :core_payment_histories, :force => true do |t|
5
+ t.integer :owner_id
6
+ t.string :owner_type, :limit => 30
7
+ t.integer :anchor_id # unique number tying paid item to our item
8
+ t.string :order_ref # order number
9
+ t.string :item_ref # specfic item number
10
+ t.string :item_name # item's name
11
+ t.integer :quantity # number of items
12
+ t.string :cost # cost of item, as a string
13
+ t.string :discount # any coupon/dicsount
14
+ t.integer :total_cents # total amount in cents
15
+ t.string :total_currency, :limit => 3 # currency 3 char code
16
+ t.string :payment_method # how payment was made: cash, credit card, etc
17
+ t.datetime :payment_date # date of payment
18
+ t.string :bill_to_name # who actually paid / was billed to
19
+ t.text :item_details # any specific item details sent by payment processor
20
+ t.text :order_details # any specific order details sent by payment processor
21
+ t.string :current_stage # current stage of payment
22
+ t.integer :user_profile_id # user_profile if payment was enetered manually
23
+ t.datetime :created_on
24
+ t.integer :account_id
25
+ end
26
+
27
+ add_index "core_payment_histories", ["anchor_id"], :name => "index_payment_histories_on_anchor_id"
28
+ add_index "core_payment_histories", ["item_ref"], :name => "index_payment_histories_on_item_ref"
29
+ add_index "core_payment_histories", ["order_ref"], :name => "index_payment_histories_on_order_ref"
30
+ add_index "core_payment_histories", ["owner_id"], :name => "index_payment_histories_on_owner_id"
31
+ add_index "core_payment_histories", ["owner_type"], :name => "index_payment_histories_on_owner_type"
32
+ end
33
+
34
+ def down
35
+ drop_table :core_payment_histories
36
+ end
37
+ end
@@ -0,0 +1,10 @@
1
+ # This migration comes from dm_core (originally 20130625091108)
2
+ class ChangeAnchorField < ActiveRecord::Migration
3
+ def up
4
+ change_column :core_payment_histories, :anchor_id, :string, :limit => 20
5
+ end
6
+
7
+ def down
8
+ change_column :core_payment_histories, :anchor_id, :integer
9
+ end
10
+ end
@@ -0,0 +1,27 @@
1
+ # This migration comes from dm_core (originally 20130628112848)
2
+ class CreateUserSiteProfile < ActiveRecord::Migration
3
+ def up
4
+ create_table :user_site_profiles, :force => true do |t|
5
+ t.integer :user_id
6
+ t.datetime :last_access_at
7
+ t.datetime :created_at
8
+ t.datetime :updated_at
9
+ t.integer :account_id
10
+ end
11
+
12
+ User.all.find_each do |user|
13
+ Account.current = Account.find(user.account_id)
14
+ p = user.user_site_profiles.create
15
+ p.update_attribute(:account_id, user.attributes['account_id'])
16
+ p.update_attribute(:last_access_at, user.user_profile.attributes['last_access_at'])
17
+ p.update_attribute(:created_at, user.attributes['created_at'])
18
+ p.update_attribute(:updated_at, user.attributes['updated_at'])
19
+ end
20
+ remove_column :user_profiles, :last_access_at
21
+ end
22
+
23
+ def down
24
+ drop_table :user_site_profiles
25
+ add_column :user_profiles, :last_access_at, :datetime
26
+ end
27
+ end
@@ -0,0 +1,12 @@
1
+ # This migration comes from dm_core (originally 20130708150236)
2
+ class AddAvatar < ActiveRecord::Migration
3
+ def change
4
+ add_column :user_profiles, :public_avatar, :string
5
+ add_column :user_profiles, :public_avatar_file_size, :integer
6
+ add_column :user_profiles, :public_avatar_content_type, :string
7
+ add_column :user_profiles, :private_avatar, :string
8
+ add_column :user_profiles, :private_avatar_file_size, :integer
9
+ add_column :user_profiles, :private_avatar_content_type, :string
10
+ add_column :user_profiles, :use_private_avatar_for_public, :boolean, :default => false
11
+ end
12
+ end
@@ -0,0 +1,8 @@
1
+ # This migration comes from dm_core (originally 20130914132041)
2
+ class AddNotifyToPaymentHistory < ActiveRecord::Migration
3
+ def change
4
+ add_column :core_payment_histories, :notify_data, :text
5
+ add_column :core_payment_histories, :transaction_id, :string
6
+ rename_column :core_payment_histories, :current_stage, :status
7
+ end
8
+ end
@@ -0,0 +1,28 @@
1
+ # This migration comes from dm_core (originally 20140105133446)
2
+ class ActsAsVotableMigration < ActiveRecord::Migration
3
+ def self.up
4
+ create_table :votes do |t|
5
+
6
+ t.references :votable, :polymorphic => true
7
+ t.references :voter, :polymorphic => true
8
+
9
+ t.boolean :vote_flag
10
+ t.string :vote_scope
11
+ t.integer :vote_weight
12
+
13
+ t.timestamps null: true
14
+ end
15
+
16
+ if ActiveRecord::VERSION::MAJOR < 4
17
+ add_index :votes, [:votable_id, :votable_type]
18
+ add_index :votes, [:voter_id, :voter_type]
19
+ end
20
+
21
+ add_index :votes, [:voter_id, :voter_type, :vote_scope]
22
+ add_index :votes, [:votable_id, :votable_type, :vote_scope]
23
+ end
24
+
25
+ def self.down
26
+ drop_table :votes
27
+ end
28
+ end
@@ -0,0 +1,19 @@
1
+ # This migration comes from dm_core (originally 20140107112418)
2
+ class UserSiteProfile < ActiveRecord::Base
3
+ end
4
+
5
+ class AddUserSiteProfileUuid < ActiveRecord::Migration
6
+ def up
7
+ add_column :user_site_profiles, :uuid, :string, :limit => 40
8
+ add_index :user_site_profiles, :uuid
9
+
10
+ #--- Create uuid for existing records
11
+ UserSiteProfile.all.each do |profile|
12
+ profile.update_attribute(:uuid, SecureRandom.uuid)
13
+ end
14
+ end
15
+
16
+ def down
17
+ remove_column :user_site_profiles, :uuid
18
+ end
19
+ end
@@ -0,0 +1,7 @@
1
+ # This migration comes from dm_core (originally 20140129110547)
2
+ class AddInvoiceId < ActiveRecord::Migration
3
+ def change
4
+ # used to track an atomically increasing invoice id for an account (used in payments)
5
+ add_column :core_accounts, :invoice_id_counter, :integer
6
+ end
7
+ end
@@ -0,0 +1,18 @@
1
+ # This migration comes from dm_core (originally 20140201092656)
2
+ class ActsAsFollowerMigration < ActiveRecord::Migration
3
+ def self.up
4
+ create_table :follows, :force => true do |t|
5
+ t.references :followable, :polymorphic => true, :null => false
6
+ t.references :follower, :polymorphic => true, :null => false
7
+ t.boolean :blocked, :default => false, :null => false
8
+ t.timestamps null: true
9
+ end
10
+
11
+ add_index :follows, ["follower_id", "follower_type"], :name => "fk_follows"
12
+ add_index :follows, ["followable_id", "followable_type"], :name => "fk_followables"
13
+ end
14
+
15
+ def self.down
16
+ drop_table :follows
17
+ end
18
+ end
@@ -0,0 +1,12 @@
1
+ # This migration comes from dm_core (originally 20140203131320)
2
+ class RenameInvoiceId < ActiveRecord::Migration
3
+ def up
4
+ remove_column :core_accounts, :invoice_id_counter
5
+ add_column :core_accounts, :next_invoice_num, :integer, :default => 1000
6
+ end
7
+
8
+ def down
9
+ remove_column :core_accounts, :next_invoice_num
10
+ add_column :core_accounts, :invoice_id_counter, :integer
11
+ end
12
+ end
@@ -0,0 +1,18 @@
1
+ # This migration comes from dm_core (originally 20140210195143)
2
+ class AddCoreAddresses < ActiveRecord::Migration
3
+ def change
4
+ create_table :core_addresses do |t|
5
+ t.string :line1
6
+ t.string :line2
7
+ t.string :city
8
+ t.string :state
9
+ t.string :zip
10
+ t.string :country_code, limit: 2
11
+ t.integer :addressable_id
12
+ t.string :addressable_type
13
+ t.timestamps null: true
14
+ end
15
+
16
+ add_index :core_addresses, [:addressable_type, :addressable_id], :unique => true
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ # This migration comes from dm_core (originally 20140411190454)
2
+ class PapertrailIncreaseColumn < ActiveRecord::Migration
3
+ def up
4
+ change_column :versions, :object_changes, :mediumtext
5
+ end
6
+ def down
7
+ change_column :versions, :object_changes, :text
8
+ end
9
+ end
@@ -0,0 +1,32 @@
1
+ # This migration comes from dm_core (originally 20140501160009)
2
+ # This migration comes from acts_as_taggable_on_engine (originally 1)
3
+ class ActsAsTaggableOnMigration < ActiveRecord::Migration
4
+ def self.up
5
+ create_table :tags do |t|
6
+ t.string :name
7
+ end
8
+
9
+ create_table :taggings do |t|
10
+ t.references :tag
11
+
12
+ # You should make sure that the column created is
13
+ # long enough to store the required class names.
14
+ t.references :taggable, :polymorphic => true
15
+ t.references :tagger, :polymorphic => true
16
+
17
+ # Limit is created to prevent MySQL error on index
18
+ # length for MyISAM table type: http://bit.ly/vgW2Ql
19
+ t.string :context, :limit => 128
20
+
21
+ t.datetime :created_at
22
+ end
23
+
24
+ add_index :taggings, :tag_id
25
+ add_index :taggings, [:taggable_id, :taggable_type, :context]
26
+ end
27
+
28
+ def self.down
29
+ drop_table :taggings
30
+ drop_table :tags
31
+ end
32
+ end
@@ -0,0 +1,23 @@
1
+ # This migration comes from dm_core (originally 20140501160010)
2
+ # This migration comes from acts_as_taggable_on_engine (originally 2)
3
+ class AddMissingUniqueIndices < ActiveRecord::Migration
4
+
5
+ def self.up
6
+ add_index :tags, :name, unique: true
7
+
8
+ remove_index :taggings, :tag_id
9
+ remove_index :taggings, [:taggable_id, :taggable_type, :context]
10
+ add_index :taggings,
11
+ [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type],
12
+ unique: true, name: 'taggings_idx'
13
+ end
14
+
15
+ def self.down
16
+ remove_index :tags, :name
17
+
18
+ remove_index :taggings, name: 'taggings_idx'
19
+ add_index :taggings, :tag_id
20
+ add_index :taggings, [:taggable_id, :taggable_type, :context]
21
+ end
22
+
23
+ end
@@ -0,0 +1,16 @@
1
+ # This migration comes from dm_core (originally 20140501160011)
2
+ # This migration comes from acts_as_taggable_on_engine (originally 3)
3
+ class AddTaggingsCounterCacheToTags < ActiveRecord::Migration
4
+ def self.up
5
+ add_column :tags, :taggings_count, :integer, :default => 0
6
+
7
+ ActsAsTaggableOn::Tag.reset_column_information
8
+ ActsAsTaggableOn::Tag.find_each do |tag|
9
+ ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings)
10
+ end
11
+ end
12
+
13
+ def self.down
14
+ remove_column :tags, :taggings_count
15
+ end
16
+ end
@@ -0,0 +1,40 @@
1
+ # This migration comes from dm_core (originally 20140529164730)
2
+ class CreateCustomFields < ActiveRecord::Migration
3
+ def change
4
+ create_table :core_custom_field_defs do |t|
5
+ t.references :owner, polymorphic: true
6
+ t.string :name
7
+ t.string :field_type
8
+ t.integer :row_order
9
+ t.boolean :required, default: false
10
+ t.string :properties, limit: 2048
11
+ t.timestamps null: true
12
+ t.integer :account_id
13
+ end
14
+
15
+ add_index :core_custom_field_defs, :account_id
16
+ add_index :core_custom_field_defs, [:owner_id, :owner_type]
17
+
18
+ create_table :core_custom_field_def_translations, force: true do |t|
19
+ t.integer :core_custom_field_def_id
20
+ t.string :locale
21
+ t.string :label
22
+ t.text :description
23
+ t.datetime :created_at
24
+ t.datetime :updated_at
25
+ end
26
+
27
+ add_index :core_custom_field_def_translations, [:core_custom_field_def_id], name: 'core_custom_field_def_translations_index'
28
+
29
+ create_table :core_custom_fields do |t|
30
+ t.references :owner, polymorphic: true
31
+ t.integer :custom_field_def_id
32
+ t.string :field_data, limit: 4096
33
+ t.timestamps null: true
34
+ t.integer :account_id
35
+ end
36
+
37
+ add_index :core_custom_fields, :account_id
38
+ add_index :core_custom_fields, [:owner_id, :owner_type]
39
+ end
40
+ end
@@ -0,0 +1,11 @@
1
+ # This migration comes from dm_core (originally 20140709145503)
2
+ # This migration comes from acts_as_taggable_on_engine (originally 4)
3
+ class AddMissingTaggableIndex < ActiveRecord::Migration
4
+ def self.up
5
+ add_index :taggings, [:taggable_id, :taggable_type, :context]
6
+ end
7
+
8
+ def self.down
9
+ remove_index :taggings, [:taggable_id, :taggable_type, :context]
10
+ end
11
+ end
@@ -0,0 +1,92 @@
1
+ # This migration comes from dm_cms (originally 20121103181909)
2
+ class CreateCms < ActiveRecord::Migration
3
+ def up
4
+ create_table "cms_contentitem_translations", :force => true do |t|
5
+ t.integer "cms_contentitem_id"
6
+ t.string "locale"
7
+ t.text "content"
8
+ t.datetime "created_at"
9
+ t.datetime "updated_at"
10
+ end
11
+
12
+ add_index "cms_contentitem_translations", ["cms_contentitem_id"], :name => "index_072c3a76f87c96e2f91149eccd2a283dca2b613f"
13
+
14
+ create_table "cms_contentitems", :force => true do |t|
15
+ t.integer "cms_page_id"
16
+ t.string "itemtype", :limit => 30, :default => "textile"
17
+ t.string "container", :limit => 30
18
+ t.integer "position", :default => 0
19
+ t.boolean "enable_cache", :default => true, :null => false
20
+ t.datetime "created_on"
21
+ t.datetime "updated_on"
22
+ t.integer "lock_version", :default => 0
23
+ end
24
+
25
+ add_index "cms_contentitems", ["cms_page_id"], :name => "cms_contentitems_cms_page_id_index"
26
+
27
+ create_table "cms_page_translations", :force => true do |t|
28
+ t.integer "cms_page_id"
29
+ t.string "locale"
30
+ t.string "title"
31
+ t.string "menutitle"
32
+ t.datetime "created_at"
33
+ t.datetime "updated_at"
34
+ end
35
+
36
+ add_index "cms_page_translations", ["cms_page_id"], :name => "index_cms_page_translations_on_cms_page_id"
37
+
38
+ create_table "cms_pages", :force => true do |t|
39
+ t.string "slug", :limit => 50, :default => "", :null => false
40
+ t.string "pagetype", :limit => 20, :default => "content", :null => false
41
+ t.boolean "published", :default => false, :null => false
42
+ t.string "template", :limit => 50, :default => "", :null => false
43
+ t.string "link", :default => "", :null => false
44
+ t.string "menuimage"
45
+ t.boolean "requires_login", :default => false
46
+ t.string "ancestry"
47
+ t.integer 'ancestry_depth', :default => 0
48
+ t.integer 'position'
49
+ t.datetime "updated_on"
50
+ t.datetime "created_on"
51
+ t.integer "lock_version", :default => 0, :null => false
52
+ end
53
+
54
+ add_index "cms_pages", ["slug"], :name => "pagename_key"
55
+ add_index "cms_pages", "ancestry"
56
+ add_index "cms_pages", "ancestry_depth"
57
+ add_index "cms_pages", ["published"], :name => "cms_pages_published_index"
58
+
59
+ create_table "cms_snippet_translations", :force => true do |t|
60
+ t.integer "cms_snippet_id"
61
+ t.string "locale"
62
+ t.text "content"
63
+ t.datetime "created_at"
64
+ t.datetime "updated_at"
65
+ end
66
+
67
+ add_index "cms_snippet_translations", ["cms_snippet_id"], :name => "index_cms_snippet_translations_on_cms_snippet_id"
68
+
69
+ create_table "cms_snippets", :force => true do |t|
70
+ t.string "itemtype", :limit => 30, :default => "textile"
71
+ t.string "container"
72
+ t.string "description"
73
+ t.boolean "enable_cache", :default => true, :null => false
74
+ t.boolean "published", :default => true, :null => false
75
+ t.datetime "created_on"
76
+ t.datetime "updated_on"
77
+ t.integer "lock_version", :default => 0
78
+ end
79
+
80
+ add_index "cms_snippets", ["container"], :name => "index_cms_snippets_on_container"
81
+
82
+ end
83
+
84
+ def down
85
+ drop_table :cms_snippets
86
+ drop_table :cms_snippet_translations
87
+ drop_table :cms_pages
88
+ drop_table :cms_page_translations
89
+ drop_table :cms_contentitems
90
+ drop_table :cms_contentitem_translations
91
+ end
92
+ end
@@ -0,0 +1,11 @@
1
+ # This migration comes from dm_cms (originally 20130206213720)
2
+ class AddAccountToCms < ActiveRecord::Migration
3
+ def change
4
+ add_column :cms_pages, :account_id, :integer
5
+ add_index :cms_pages, :account_id
6
+ add_column :cms_contentitems, :account_id, :integer
7
+ add_index :cms_contentitems, :account_id
8
+ add_column :cms_snippets, :account_id, :integer
9
+ add_index :cms_snippets, :account_id
10
+ end
11
+ end
@@ -0,0 +1,62 @@
1
+ # This migration comes from dm_cms (originally 20130507123255)
2
+ class CreateBlog < ActiveRecord::Migration
3
+ def up
4
+ create_table :cms_blog_translations, :force => true do |t|
5
+ t.integer :cms_blog_id
6
+ t.string :locale
7
+ t.string :title
8
+ t.datetime :created_at
9
+ t.datetime :updated_at
10
+ end
11
+
12
+ add_index :cms_blog_translations, ["cms_blog_id"], :name => "index_cms_blog_translations_on_cms_blog_id"
13
+
14
+ create_table :cms_blogs, :force => true do |t|
15
+ t.string :slug
16
+ t.boolean :published, :default => false
17
+ t.boolean :is_public, :default => false
18
+ t.boolean :requires_login, :default => false
19
+ t.integer :row_order
20
+ t.datetime :updated_on
21
+ t.datetime :created_on
22
+ t.integer :account_id
23
+ t.integer :lock_version, :default => 0, :null => false
24
+ end
25
+
26
+ add_index :cms_blogs, ["slug"], :name => "blogname_key"
27
+ add_index :cms_blogs, ["published"], :name => "cms_blogs_published_index"
28
+
29
+ create_table :cms_post_translations, :force => true do |t|
30
+ t.integer :cms_post_id
31
+ t.string :locale
32
+ t.string :title
33
+ t.text :content
34
+ t.text :summary
35
+ t.datetime :created_at
36
+ t.datetime :updated_at
37
+ end
38
+
39
+ add_index :cms_post_translations, ["cms_post_id"], :name => "index_cms_post_translations_on_cms_post_id"
40
+
41
+ create_table :cms_posts, :force => true do |t|
42
+ t.string :slug
43
+ t.integer :cms_blog_id
44
+ t.string :image
45
+ t.datetime :published_on
46
+ t.datetime :updated_on
47
+ t.datetime :created_on
48
+ t.integer :account_id
49
+ t.integer :lock_version, :default => 0, :null => false
50
+ end
51
+
52
+ add_index :cms_posts, ["slug"], :name => "postname_key"
53
+ add_index :cms_posts, ["published_on"], :name => "cms_posts_published_index"
54
+ end
55
+
56
+ def down
57
+ drop_table :cms_blogs
58
+ drop_table :cms_blog_translations
59
+ drop_table :cms_posts
60
+ drop_table :cms_post_translations
61
+ end
62
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from dm_cms (originally 20130531212537)
2
+ class AddNotificationSent < ActiveRecord::Migration
3
+ def change
4
+ add_column :cms_posts, :notification_sent_on, :datetime
5
+ end
6
+ end
@@ -0,0 +1,8 @@
1
+ # This migration comes from dm_cms (originally 20130605184116)
2
+ class AddBlogComment < ActiveRecord::Migration
3
+ def change
4
+ add_column :cms_posts, :comments_count, :integer, :default => 0
5
+ add_column :cms_posts, :comments_allowed, :boolean
6
+ add_column :cms_blogs, :comments_allowed, :boolean
7
+ end
8
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from dm_cms (originally 20131128201053)
2
+ class AddBlogImage < ActiveRecord::Migration
3
+ def change
4
+ add_column :cms_blogs, :image, :string
5
+ end
6
+ end