dm_newsletter 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 (130) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +33 -0
  4. data/Rakefile +30 -0
  5. data/app/assets/stylesheets/dm_newsletter/application.css +13 -0
  6. data/app/controllers/dm_newsletter/admin/admin_controller.rb +16 -0
  7. data/app/controllers/dm_newsletter/admin/newsletters_controller.rb +81 -0
  8. data/app/controllers/dm_newsletter/application_controller.rb +3 -0
  9. data/app/controllers/dm_newsletter/newsletters_controller.rb +50 -0
  10. data/app/helpers/dm_newsletter/newsletters_helper.rb +8 -0
  11. data/app/models/dm_newsletter/concerns/ability.rb +37 -0
  12. data/app/models/dm_newsletter/permitted_params.rb +20 -0
  13. data/app/models/mailchimp_newsletter.rb +217 -0
  14. data/app/models/mailchimp_newsletter_subscriber.rb +43 -0
  15. data/app/models/newsletter.rb +46 -0
  16. data/app/models/newsletter_subscriber.rb +257 -0
  17. data/app/models/standard_newsletter.rb +19 -0
  18. data/app/views/dm_newsletter/admin/newsletters/_form.html.erb +17 -0
  19. data/app/views/dm_newsletter/admin/newsletters/edit.html.erb +2 -0
  20. data/app/views/dm_newsletter/admin/newsletters/index.html.erb +32 -0
  21. data/app/views/dm_newsletter/admin/newsletters/new.html.erb +2 -0
  22. data/app/views/dm_newsletter/admin/newsletters/show.html.erb +46 -0
  23. data/config/locales/nms.cs.yml +15 -0
  24. data/config/locales/nms.de.yml +15 -0
  25. data/config/locales/nms.en.yml +15 -0
  26. data/config/locales/nms.fi.yml +15 -0
  27. data/config/locales/nms.ja.yml +15 -0
  28. data/config/routes.rb +15 -0
  29. data/db/20130730120724_create_subscribers.rb +32 -0
  30. data/db/migrate/20130729075442_create_newsletter.rb +24 -0
  31. data/lib/dm_newsletter.rb +4 -0
  32. data/lib/dm_newsletter/engine.rb +8 -0
  33. data/lib/tasks/dm_newsletter_tasks.rake +4 -0
  34. data/spec/dummy/README.rdoc +28 -0
  35. data/spec/dummy/Rakefile +6 -0
  36. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  37. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  38. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  39. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  40. data/spec/dummy/app/models/ability.rb +12 -0
  41. data/spec/dummy/app/models/user.rb +6 -0
  42. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  43. data/spec/dummy/bin/bundle +3 -0
  44. data/spec/dummy/bin/rails +4 -0
  45. data/spec/dummy/bin/rake +4 -0
  46. data/spec/dummy/config.ru +4 -0
  47. data/spec/dummy/config/application.rb +26 -0
  48. data/spec/dummy/config/boot.rb +5 -0
  49. data/spec/dummy/config/database.yml +25 -0
  50. data/spec/dummy/config/environment.rb +5 -0
  51. data/spec/dummy/config/environments/development.rb +37 -0
  52. data/spec/dummy/config/environments/production.rb +82 -0
  53. data/spec/dummy/config/environments/test.rb +39 -0
  54. data/spec/dummy/config/initializers/assets.rb +8 -0
  55. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  56. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  57. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  58. data/spec/dummy/config/initializers/inflections.rb +16 -0
  59. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  60. data/spec/dummy/config/initializers/session_store.rb +3 -0
  61. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  62. data/spec/dummy/config/locales/en.yml +23 -0
  63. data/spec/dummy/config/routes.rb +12 -0
  64. data/spec/dummy/config/secrets.yml +22 -0
  65. data/spec/dummy/db/development.sqlite3 +0 -0
  66. data/spec/dummy/db/migrate/20141114170927_add_globalize_countries.dm_core.rb +50 -0
  67. data/spec/dummy/db/migrate/20141114170928_devise_create_users.dm_core.rb +46 -0
  68. data/spec/dummy/db/migrate/20141114170929_add_user_fields.dm_core.rb +14 -0
  69. data/spec/dummy/db/migrate/20141114170930_rolify_create_roles.dm_core.rb +20 -0
  70. data/spec/dummy/db/migrate/20141114170931_add_last_access.dm_core.rb +10 -0
  71. data/spec/dummy/db/migrate/20141114170932_create_versions.dm_core.rb +19 -0
  72. data/spec/dummy/db/migrate/20141114170933_add_object_changes_column_to_versions.dm_core.rb +12 -0
  73. data/spec/dummy/db/migrate/20141114170934_create_dm_core_accounts.dm_core.rb +13 -0
  74. data/spec/dummy/db/migrate/20141114170935_add_account_to_users.dm_core.rb +9 -0
  75. data/spec/dummy/db/migrate/20141114170936_create_preferences.dm_core.rb +13 -0
  76. data/spec/dummy/db/migrate/20141114170937_create_comments.dm_core.rb +22 -0
  77. data/spec/dummy/db/migrate/20141114170938_add_activity.dm_core.rb +21 -0
  78. data/spec/dummy/db/migrate/20141114170939_add_type_to_comments.dm_core.rb +9 -0
  79. data/spec/dummy/db/migrate/20141114170940_add_category.dm_core.rb +28 -0
  80. data/spec/dummy/db/migrate/20141114170941_create_email_table.dm_core.rb +26 -0
  81. data/spec/dummy/db/migrate/20141114170942_add_user_profile.dm_core.rb +46 -0
  82. data/spec/dummy/db/migrate/20141114170943_add_profile_email.dm_core.rb +14 -0
  83. data/spec/dummy/db/migrate/20141114170944_create_payment_history.dm_core.rb +37 -0
  84. data/spec/dummy/db/migrate/20141114170945_change_anchor_field.dm_core.rb +10 -0
  85. data/spec/dummy/db/migrate/20141114170946_create_user_site_profile.dm_core.rb +27 -0
  86. data/spec/dummy/db/migrate/20141114170947_add_avatar.dm_core.rb +12 -0
  87. data/spec/dummy/db/migrate/20141114170948_add_notify_to_payment_history.dm_core.rb +8 -0
  88. data/spec/dummy/db/migrate/20141114170949_acts_as_votable_migration.dm_core.rb +28 -0
  89. data/spec/dummy/db/migrate/20141114170950_add_user_site_profile_uuid.dm_core.rb +19 -0
  90. data/spec/dummy/db/migrate/20141114170951_add_invoice_id.dm_core.rb +7 -0
  91. data/spec/dummy/db/migrate/20141114170952_acts_as_follower_migration.dm_core.rb +18 -0
  92. data/spec/dummy/db/migrate/20141114170953_rename_invoice_id.dm_core.rb +12 -0
  93. data/spec/dummy/db/migrate/20141114170954_add_core_addresses.dm_core.rb +18 -0
  94. data/spec/dummy/db/migrate/20141114170955_papertrail_increase_column.dm_core.rb +9 -0
  95. data/spec/dummy/db/migrate/20141114170956_acts_as_taggable_on_migration.dm_core.rb +32 -0
  96. data/spec/dummy/db/migrate/20141114170957_add_missing_unique_indices.dm_core.rb +23 -0
  97. data/spec/dummy/db/migrate/20141114170958_add_taggings_counter_cache_to_tags.dm_core.rb +16 -0
  98. data/spec/dummy/db/migrate/20141114170959_create_custom_fields.dm_core.rb +40 -0
  99. data/spec/dummy/db/migrate/20141114170960_add_missing_taggable_index.dm_core.rb +11 -0
  100. data/spec/dummy/db/migrate/20141119112030_create_cms.dm_cms.rb +92 -0
  101. data/spec/dummy/db/migrate/20141119112031_add_account_to_cms.dm_cms.rb +11 -0
  102. data/spec/dummy/db/migrate/20141119112032_create_blog.dm_cms.rb +62 -0
  103. data/spec/dummy/db/migrate/20141119112033_add_notification_sent.dm_cms.rb +6 -0
  104. data/spec/dummy/db/migrate/20141119112034_add_blog_comment.dm_cms.rb +8 -0
  105. data/spec/dummy/db/migrate/20141119112035_add_blog_image.dm_cms.rb +6 -0
  106. data/spec/dummy/db/migrate/20141119112036_rename_snippet_slug.dm_cms.rb +14 -0
  107. data/spec/dummy/db/migrate/20141119112037_add_requires_subscription_blog.dm_cms.rb +8 -0
  108. data/spec/dummy/db/migrate/20141119112038_add_pages_ranked_model.dm_cms.rb +23 -0
  109. data/spec/dummy/db/migrate/20141119112039_add_blog_owner.dm_cms.rb +7 -0
  110. data/spec/dummy/db/migrate/20141119112040_create_media_files.dm_cms.rb +30 -0
  111. data/spec/dummy/db/migrate/20141119112041_add_cmspage_summary.dm_cms.rb +7 -0
  112. data/spec/dummy/db/migrate/20141119112042_add_blog_image_email_header.dm_cms.rb +6 -0
  113. data/spec/dummy/db/migrate/20141119112043_add_header_image.dm_cms.rb +10 -0
  114. data/spec/dummy/db/migrate/20160128145239_add_favored_locale.dm_core.rb +17 -0
  115. data/spec/dummy/db/migrate/20160128145240_update_papertrail_v4.dm_core.rb +41 -0
  116. data/spec/dummy/db/schema.rb +593 -0
  117. data/spec/dummy/public/404.html +67 -0
  118. data/spec/dummy/public/422.html +67 -0
  119. data/spec/dummy/public/500.html +66 -0
  120. data/spec/dummy/public/favicon.ico +0 -0
  121. data/spec/factories/accounts.rb +9 -0
  122. data/spec/factories/user_profiles.rb +10 -0
  123. data/spec/factories/users.rb +19 -0
  124. data/spec/models/newsletter_spec.rb +9 -0
  125. data/spec/rails_helper.rb +70 -0
  126. data/spec/spec_helper.rb +85 -0
  127. data/spec/support/accounts.rb +17 -0
  128. data/spec/support/devise.rb +44 -0
  129. data/spec/support/fix_locale.rb +57 -0
  130. metadata +296 -0
@@ -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
@@ -0,0 +1,14 @@
1
+ # This migration comes from dm_cms (originally 20140217135228)
2
+ class RenameSnippetSlug < ActiveRecord::Migration
3
+ def up
4
+ change_column :cms_snippets, :itemtype, :string, :default => 'markdown'
5
+ rename_column :cms_snippets, :container, :slug
6
+ rename_index :cms_snippets, 'index_cms_snippets_on_container', 'index_cms_snippets_on_slug'
7
+ end
8
+
9
+ def down
10
+ change_column :cms_snippets, :itemtype, :string, :default => 'textile'
11
+ rename_column :cms_snippets, :slug, :container
12
+ rename_index :cms_snippets, 'index_cms_snippets_on_slug', 'index_cms_snippets_on_container'
13
+ end
14
+ end
@@ -0,0 +1,8 @@
1
+ # This migration comes from dm_cms (originally 20140303121217)
2
+ class AddRequiresSubscriptionBlog < ActiveRecord::Migration
3
+ def change
4
+ add_column :cms_blogs, :requires_subscription, :boolean, :default => false
5
+ add_column :cms_pages, :requires_subscription, :boolean, :default => false
6
+ add_column :cms_pages, :is_public, :boolean, :default => true
7
+ end
8
+ end
@@ -0,0 +1,23 @@
1
+ # This migration comes from dm_cms (originally 20140328205246)
2
+ class AddPagesRankedModel < ActiveRecord::Migration
3
+ def up
4
+ add_column :cms_pages, :row_order, :integer
5
+ rename_column :cms_contentitems, :position, :row_order
6
+
7
+ #--- because of some duplications in the position column, need to
8
+ # create a more unique position value. So add up the positions
9
+ total = 0
10
+ CmsPage.unscoped.order(:ancestry, :position).each do |page|
11
+ total = total + page.position
12
+ Account.current = Account.find(page.account_id)
13
+ page.update_attributes :row_order => total
14
+ end
15
+ remove_column :cms_pages, :position
16
+ end
17
+
18
+ def down
19
+ remove_column :cms_pages, :row_order
20
+ add_columnn :cms_pages, :position, :integer
21
+ rename_column :cms_contentitems, :row_order, :position
22
+ end
23
+ end
@@ -0,0 +1,7 @@
1
+ # This migration comes from dm_cms (originally 20140423113417)
2
+ class AddBlogOwner < ActiveRecord::Migration
3
+ def change
4
+ add_column :cms_blogs, :owner_id, :integer
5
+ add_column :cms_blogs, :owner_type, :string
6
+ end
7
+ end
@@ -0,0 +1,30 @@
1
+ # This migration comes from dm_cms (originally 20140428122156)
2
+ class CreateMediaFiles < ActiveRecord::Migration
3
+ def change
4
+ create_table :cms_media_files do |t|
5
+ t.string :media
6
+ t.integer :media_file_size
7
+ t.string :media_content_type
8
+ t.string :folder
9
+ t.boolean :generate_retina
10
+ t.integer :user_id
11
+ t.datetime :created_at
12
+ t.datetime :updated_at
13
+ t.integer :account_id
14
+ end
15
+
16
+ add_index :cms_media_files, [:media, :folder, :account_id], unique: true, name: "index_media_folder_account_id"
17
+
18
+ create_table :cms_media_file_translations, :force => true do |t|
19
+ t.integer :cms_media_file_id
20
+ t.string :locale
21
+ t.string :title
22
+ t.string :description
23
+ t.datetime :created_at
24
+ t.datetime :updated_at
25
+ end
26
+
27
+ add_index :cms_media_file_translations, [:cms_media_file_id], name: "index_cms_media_file_translations_on_cms_media_file_id"
28
+
29
+ end
30
+ end
@@ -0,0 +1,7 @@
1
+ # This migration comes from dm_cms (originally 20140523134543)
2
+ class AddCmspageSummary < ActiveRecord::Migration
3
+ def change
4
+ add_column :cms_pages, :image, :string
5
+ add_column :cms_page_translations, :summary, :text
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ # This migration comes from dm_cms (originally 20140601151631)
2
+ class AddBlogImageEmailHeader < ActiveRecord::Migration
3
+ def change
4
+ add_column :cms_blogs, :image_email_header, :string
5
+ end
6
+ end
@@ -0,0 +1,10 @@
1
+ # This migration comes from dm_cms (originally 20141004154725)
2
+ class AddHeaderImage < ActiveRecord::Migration
3
+ def change
4
+ rename_column :cms_pages, :image, :featured_image
5
+ add_column :cms_pages, :header_image, :string
6
+
7
+ rename_column :cms_blogs, :image, :header_image
8
+ rename_column :cms_posts, :image, :featured_image
9
+ end
10
+ end
@@ -0,0 +1,17 @@
1
+ # This migration comes from dm_core (originally 20141216094639)
2
+ class AddFavoredLocale < ActiveRecord::Migration
3
+ def up
4
+ add_column :user_profiles, :favored_locale, :string
5
+
6
+ locale_map = {'DE' => :de, 'AT' => :de, 'CH' => :de, 'JP' => :ja, 'FI' => :fi}
7
+ UserProfile.all.find_each do |user_profile|
8
+ country_code = user_profile.country.code
9
+ locale = locale_map[country_code].nil? ? :en : locale_map[country_code]
10
+ user_profile.update_attribute(:favored_locale, locale)
11
+ end
12
+ end
13
+
14
+ def down
15
+ remove_column :user_profiles, :favored_locale
16
+ end
17
+ end
@@ -0,0 +1,41 @@
1
+ # This migration comes from dm_core (originally 20160128094739)
2
+ # Migration for upgrading PaperTrail from V3 to V4
3
+ #------------------------------------------------------------------------------
4
+ class UpdatePapertrailV4 < ActiveRecord::Migration
5
+ # The largest text column available in all supported RDBMS is
6
+ # 1024^3 - 1 bytes, roughly one gibibyte. We specify a size
7
+ # so that MySQL will use `longtext` instead of `text`. Otherwise,
8
+ # when serializing very large objects, `text` might not be big enough.
9
+ TEXT_BYTES = 1_073_741_823
10
+
11
+ def up
12
+ change_column :versions, :created_at, :datetime, precision: 6
13
+ change_column :versions, :object, :text, limit: TEXT_BYTES
14
+ change_column :versions, :object_changes, :text, limit: TEXT_BYTES
15
+ add_column :versions, :transaction_id, :integer
16
+ add_index :versions, [:transaction_id]
17
+
18
+ create_table :version_associations do |t|
19
+ t.integer :version_id
20
+ t.string :foreign_key_name, :null => false
21
+ t.integer :foreign_key_id
22
+ end
23
+ add_index :version_associations, [:version_id]
24
+ add_index :version_associations,
25
+ [:foreign_key_name, :foreign_key_id],
26
+ :name => 'index_version_associations_on_foreign_key'
27
+ end
28
+
29
+ def down
30
+ change_column :versions, :created_at, :datetime
31
+ change_column :versions, :object, :mediumtext
32
+ change_column :versions, :object_changes, :mediumtext
33
+ remove_index :versions, [:transaction_id]
34
+ remove_column :versions, :transaction_id
35
+
36
+ remove_index :version_associations, [:version_id]
37
+ remove_index :version_associations,
38
+ :name => 'index_version_associations_on_foreign_key'
39
+ drop_table :version_associations
40
+ end
41
+ end
@@ -0,0 +1,593 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20160128145240) do
15
+
16
+ create_table "cms_blog_translations", force: :cascade do |t|
17
+ t.integer "cms_blog_id"
18
+ t.string "locale"
19
+ t.string "title"
20
+ t.datetime "created_at"
21
+ t.datetime "updated_at"
22
+ end
23
+
24
+ add_index "cms_blog_translations", ["cms_blog_id"], name: "index_cms_blog_translations_on_cms_blog_id"
25
+
26
+ create_table "cms_blogs", force: :cascade do |t|
27
+ t.string "slug"
28
+ t.boolean "published", default: false
29
+ t.boolean "is_public", default: false
30
+ t.boolean "requires_login", default: false
31
+ t.integer "row_order"
32
+ t.datetime "updated_on"
33
+ t.datetime "created_on"
34
+ t.integer "account_id"
35
+ t.integer "lock_version", default: 0, null: false
36
+ t.boolean "comments_allowed"
37
+ t.string "header_image"
38
+ t.boolean "requires_subscription", default: false
39
+ t.integer "owner_id"
40
+ t.string "owner_type"
41
+ t.string "image_email_header"
42
+ end
43
+
44
+ add_index "cms_blogs", ["published"], name: "cms_blogs_published_index"
45
+ add_index "cms_blogs", ["slug"], name: "blogname_key"
46
+
47
+ create_table "cms_contentitem_translations", force: :cascade do |t|
48
+ t.integer "cms_contentitem_id"
49
+ t.string "locale"
50
+ t.text "content"
51
+ t.datetime "created_at"
52
+ t.datetime "updated_at"
53
+ end
54
+
55
+ add_index "cms_contentitem_translations", ["cms_contentitem_id"], name: "index_072c3a76f87c96e2f91149eccd2a283dca2b613f"
56
+
57
+ create_table "cms_contentitems", force: :cascade do |t|
58
+ t.integer "cms_page_id"
59
+ t.string "itemtype", limit: 30, default: "textile"
60
+ t.string "container", limit: 30
61
+ t.integer "row_order", default: 0
62
+ t.boolean "enable_cache", default: true, null: false
63
+ t.datetime "created_on"
64
+ t.datetime "updated_on"
65
+ t.integer "lock_version", default: 0
66
+ t.integer "account_id"
67
+ end
68
+
69
+ add_index "cms_contentitems", ["account_id"], name: "index_cms_contentitems_on_account_id"
70
+ add_index "cms_contentitems", ["cms_page_id"], name: "cms_contentitems_cms_page_id_index"
71
+
72
+ create_table "cms_media_file_translations", force: :cascade do |t|
73
+ t.integer "cms_media_file_id"
74
+ t.string "locale"
75
+ t.string "title"
76
+ t.string "description"
77
+ t.datetime "created_at"
78
+ t.datetime "updated_at"
79
+ end
80
+
81
+ add_index "cms_media_file_translations", ["cms_media_file_id"], name: "index_cms_media_file_translations_on_cms_media_file_id"
82
+
83
+ create_table "cms_media_files", force: :cascade do |t|
84
+ t.string "media"
85
+ t.integer "media_file_size"
86
+ t.string "media_content_type"
87
+ t.string "folder"
88
+ t.boolean "generate_retina"
89
+ t.integer "user_id"
90
+ t.datetime "created_at"
91
+ t.datetime "updated_at"
92
+ t.integer "account_id"
93
+ end
94
+
95
+ add_index "cms_media_files", ["media", "folder", "account_id"], name: "index_media_folder_account_id", unique: true
96
+
97
+ create_table "cms_page_translations", force: :cascade do |t|
98
+ t.integer "cms_page_id"
99
+ t.string "locale"
100
+ t.string "title"
101
+ t.string "menutitle"
102
+ t.datetime "created_at"
103
+ t.datetime "updated_at"
104
+ t.text "summary"
105
+ end
106
+
107
+ add_index "cms_page_translations", ["cms_page_id"], name: "index_cms_page_translations_on_cms_page_id"
108
+
109
+ create_table "cms_pages", force: :cascade do |t|
110
+ t.string "slug", limit: 50, default: "", null: false
111
+ t.string "pagetype", limit: 20, default: "content", null: false
112
+ t.boolean "published", default: false, null: false
113
+ t.string "template", limit: 50, default: "", null: false
114
+ t.string "link", default: "", null: false
115
+ t.string "menuimage"
116
+ t.boolean "requires_login", default: false
117
+ t.string "ancestry"
118
+ t.integer "ancestry_depth", default: 0
119
+ t.datetime "updated_on"
120
+ t.datetime "created_on"
121
+ t.integer "lock_version", default: 0, null: false
122
+ t.integer "account_id"
123
+ t.boolean "requires_subscription", default: false
124
+ t.boolean "is_public", default: true
125
+ t.integer "row_order"
126
+ t.string "featured_image"
127
+ t.string "header_image"
128
+ end
129
+
130
+ add_index "cms_pages", ["account_id"], name: "index_cms_pages_on_account_id"
131
+ add_index "cms_pages", ["ancestry"], name: "index_cms_pages_on_ancestry"
132
+ add_index "cms_pages", ["ancestry_depth"], name: "index_cms_pages_on_ancestry_depth"
133
+ add_index "cms_pages", ["published"], name: "cms_pages_published_index"
134
+ add_index "cms_pages", ["slug"], name: "pagename_key"
135
+
136
+ create_table "cms_post_translations", force: :cascade do |t|
137
+ t.integer "cms_post_id"
138
+ t.string "locale"
139
+ t.string "title"
140
+ t.text "content"
141
+ t.text "summary"
142
+ t.datetime "created_at"
143
+ t.datetime "updated_at"
144
+ end
145
+
146
+ add_index "cms_post_translations", ["cms_post_id"], name: "index_cms_post_translations_on_cms_post_id"
147
+
148
+ create_table "cms_posts", force: :cascade do |t|
149
+ t.string "slug"
150
+ t.integer "cms_blog_id"
151
+ t.string "featured_image"
152
+ t.datetime "published_on"
153
+ t.datetime "updated_on"
154
+ t.datetime "created_on"
155
+ t.integer "account_id"
156
+ t.integer "lock_version", default: 0, null: false
157
+ t.datetime "notification_sent_on"
158
+ t.integer "comments_count", default: 0
159
+ t.boolean "comments_allowed"
160
+ end
161
+
162
+ add_index "cms_posts", ["published_on"], name: "cms_posts_published_index"
163
+ add_index "cms_posts", ["slug"], name: "postname_key"
164
+
165
+ create_table "cms_snippet_translations", force: :cascade do |t|
166
+ t.integer "cms_snippet_id"
167
+ t.string "locale"
168
+ t.text "content"
169
+ t.datetime "created_at"
170
+ t.datetime "updated_at"
171
+ end
172
+
173
+ add_index "cms_snippet_translations", ["cms_snippet_id"], name: "index_cms_snippet_translations_on_cms_snippet_id"
174
+
175
+ create_table "cms_snippets", force: :cascade do |t|
176
+ t.string "itemtype", limit: 30, default: "markdown"
177
+ t.string "slug"
178
+ t.string "description"
179
+ t.boolean "enable_cache", default: true, null: false
180
+ t.boolean "published", default: true, null: false
181
+ t.datetime "created_on"
182
+ t.datetime "updated_on"
183
+ t.integer "lock_version", default: 0
184
+ t.integer "account_id"
185
+ end
186
+
187
+ add_index "cms_snippets", ["account_id"], name: "index_cms_snippets_on_account_id"
188
+ add_index "cms_snippets", ["slug"], name: "index_cms_snippets_on_slug"
189
+
190
+ create_table "core_accounts", force: :cascade do |t|
191
+ t.string "company_name"
192
+ t.string "contact_email"
193
+ t.string "domain"
194
+ t.string "account_prefix"
195
+ t.integer "default_site_id"
196
+ t.datetime "created_at"
197
+ t.datetime "updated_at"
198
+ t.integer "next_invoice_num", default: 1000
199
+ end
200
+
201
+ create_table "core_activities", force: :cascade do |t|
202
+ t.integer "account_id"
203
+ t.integer "user_id"
204
+ t.string "browser"
205
+ t.string "session_id"
206
+ t.string "ip_address"
207
+ t.string "controller"
208
+ t.string "action"
209
+ t.string "params"
210
+ t.string "slug"
211
+ t.string "lesson"
212
+ t.datetime "created_at"
213
+ end
214
+
215
+ add_index "core_activities", ["account_id"], name: "index_core_activities_on_account_id"
216
+ add_index "core_activities", ["user_id"], name: "index_core_activities_on_user_id"
217
+
218
+ create_table "core_addresses", force: :cascade do |t|
219
+ t.string "line1"
220
+ t.string "line2"
221
+ t.string "city"
222
+ t.string "state"
223
+ t.string "zip"
224
+ t.string "country_code", limit: 2
225
+ t.integer "addressable_id"
226
+ t.string "addressable_type"
227
+ t.datetime "created_at"
228
+ t.datetime "updated_at"
229
+ end
230
+
231
+ add_index "core_addresses", ["addressable_type", "addressable_id"], name: "index_core_addresses_on_addressable_type_and_addressable_id", unique: true
232
+
233
+ create_table "core_categories", force: :cascade do |t|
234
+ t.string "type"
235
+ t.integer "row_order"
236
+ t.integer "account_id"
237
+ t.datetime "created_on"
238
+ t.datetime "updated_on"
239
+ end
240
+
241
+ create_table "core_category_translations", force: :cascade do |t|
242
+ t.integer "core_category_id"
243
+ t.string "locale"
244
+ t.string "name"
245
+ t.string "description"
246
+ t.datetime "created_at"
247
+ t.datetime "updated_at"
248
+ end
249
+
250
+ add_index "core_category_translations", ["core_category_id"], name: "index_category_translation"
251
+
252
+ create_table "core_comments", force: :cascade do |t|
253
+ t.string "title", limit: 50, default: ""
254
+ t.text "body"
255
+ t.integer "commentable_id"
256
+ t.string "commentable_type"
257
+ t.integer "user_id"
258
+ t.string "role", default: "comments"
259
+ t.integer "account_id"
260
+ t.datetime "created_at"
261
+ t.datetime "updated_at"
262
+ t.string "type"
263
+ t.string "ancestry"
264
+ t.integer "ancestry_depth", default: 0
265
+ end
266
+
267
+ add_index "core_comments", ["commentable_id"], name: "index_core_comments_on_commentable_id"
268
+ add_index "core_comments", ["commentable_type"], name: "index_core_comments_on_commentable_type"
269
+ add_index "core_comments", ["user_id"], name: "index_core_comments_on_user_id"
270
+
271
+ create_table "core_custom_field_def_translations", force: :cascade do |t|
272
+ t.integer "core_custom_field_def_id"
273
+ t.string "locale"
274
+ t.string "label"
275
+ t.text "description"
276
+ t.datetime "created_at"
277
+ t.datetime "updated_at"
278
+ end
279
+
280
+ add_index "core_custom_field_def_translations", ["core_custom_field_def_id"], name: "core_custom_field_def_translations_index"
281
+
282
+ create_table "core_custom_field_defs", force: :cascade do |t|
283
+ t.integer "owner_id"
284
+ t.string "owner_type"
285
+ t.string "name"
286
+ t.string "field_type"
287
+ t.integer "row_order"
288
+ t.boolean "required", default: false
289
+ t.string "properties", limit: 2048
290
+ t.datetime "created_at"
291
+ t.datetime "updated_at"
292
+ t.integer "account_id"
293
+ end
294
+
295
+ add_index "core_custom_field_defs", ["account_id"], name: "index_core_custom_field_defs_on_account_id"
296
+ add_index "core_custom_field_defs", ["owner_id", "owner_type"], name: "index_core_custom_field_defs_on_owner_id_and_owner_type"
297
+
298
+ create_table "core_custom_fields", force: :cascade do |t|
299
+ t.integer "owner_id"
300
+ t.string "owner_type"
301
+ t.integer "custom_field_def_id"
302
+ t.string "field_data", limit: 4096
303
+ t.datetime "created_at"
304
+ t.datetime "updated_at"
305
+ t.integer "account_id"
306
+ end
307
+
308
+ add_index "core_custom_fields", ["account_id"], name: "index_core_custom_fields_on_account_id"
309
+ add_index "core_custom_fields", ["owner_id", "owner_type"], name: "index_core_custom_fields_on_owner_id_and_owner_type"
310
+
311
+ create_table "core_payment_histories", force: :cascade do |t|
312
+ t.integer "owner_id"
313
+ t.string "owner_type", limit: 30
314
+ t.string "anchor_id", limit: 20
315
+ t.string "order_ref"
316
+ t.string "item_ref"
317
+ t.string "item_name"
318
+ t.integer "quantity"
319
+ t.string "cost"
320
+ t.string "discount"
321
+ t.integer "total_cents"
322
+ t.string "total_currency", limit: 3
323
+ t.string "payment_method"
324
+ t.datetime "payment_date"
325
+ t.string "bill_to_name"
326
+ t.text "item_details"
327
+ t.text "order_details"
328
+ t.string "status"
329
+ t.integer "user_profile_id"
330
+ t.datetime "created_on"
331
+ t.integer "account_id"
332
+ t.text "notify_data"
333
+ t.string "transaction_id"
334
+ end
335
+
336
+ add_index "core_payment_histories", ["anchor_id"], name: "index_payment_histories_on_anchor_id"
337
+ add_index "core_payment_histories", ["item_ref"], name: "index_payment_histories_on_item_ref"
338
+ add_index "core_payment_histories", ["order_ref"], name: "index_payment_histories_on_order_ref"
339
+ add_index "core_payment_histories", ["owner_id"], name: "index_payment_histories_on_owner_id"
340
+ add_index "core_payment_histories", ["owner_type"], name: "index_payment_histories_on_owner_type"
341
+
342
+ create_table "core_system_email_translations", force: :cascade do |t|
343
+ t.integer "core_system_email_id"
344
+ t.string "locale"
345
+ t.string "subject"
346
+ t.text "body"
347
+ t.datetime "created_at"
348
+ t.datetime "updated_at"
349
+ end
350
+
351
+ create_table "core_system_emails", force: :cascade do |t|
352
+ t.string "email_type"
353
+ t.integer "emailable_id"
354
+ t.string "emailable_type"
355
+ t.datetime "created_at"
356
+ t.datetime "updated_at"
357
+ t.integer "account_id"
358
+ end
359
+
360
+ create_table "email_newsletters", force: :cascade do |t|
361
+ t.string "token"
362
+ t.string "name"
363
+ t.boolean "require_name", default: false
364
+ t.boolean "require_country", default: false
365
+ t.integer "subscribed_count", default: 0
366
+ t.integer "unsubscribed_count", default: 0
367
+ t.integer "cleaned_count", default: 0
368
+ t.datetime "created_at"
369
+ t.datetime "updated_at"
370
+ t.integer "account_id"
371
+ t.string "type"
372
+ t.string "mc_id"
373
+ t.boolean "deleted", default: false
374
+ end
375
+
376
+ add_index "email_newsletters", ["account_id"], name: "index_email_newsletters_on_account_id"
377
+ add_index "email_newsletters", ["mc_id"], name: "index_email_newsletters_on_mc_id"
378
+ add_index "email_newsletters", ["token"], name: "index_email_newsletters_on_token"
379
+
380
+ create_table "follows", force: :cascade do |t|
381
+ t.integer "followable_id", null: false
382
+ t.string "followable_type", null: false
383
+ t.integer "follower_id", null: false
384
+ t.string "follower_type", null: false
385
+ t.boolean "blocked", default: false, null: false
386
+ t.datetime "created_at"
387
+ t.datetime "updated_at"
388
+ end
389
+
390
+ add_index "follows", ["followable_id", "followable_type"], name: "fk_followables"
391
+ add_index "follows", ["follower_id", "follower_type"], name: "fk_follows"
392
+
393
+ create_table "globalize_countries", force: :cascade do |t|
394
+ t.string "code", limit: 2
395
+ t.string "english_name"
396
+ t.string "date_format"
397
+ t.string "currency_format"
398
+ t.string "currency_code", limit: 3
399
+ t.string "thousands_sep", limit: 2
400
+ t.string "decimal_sep", limit: 2
401
+ t.string "currency_decimal_sep", limit: 2
402
+ t.string "number_grouping_scheme"
403
+ t.string "continent"
404
+ t.string "locale"
405
+ end
406
+
407
+ add_index "globalize_countries", ["code"], name: "index_globalize_countries_on_code"
408
+ add_index "globalize_countries", ["locale"], name: "index_globalize_countries_on_locale"
409
+
410
+ create_table "globalize_languages", force: :cascade do |t|
411
+ t.string "iso_639_1", limit: 2
412
+ t.string "iso_639_2", limit: 3
413
+ t.string "iso_639_3", limit: 3
414
+ t.string "rfc_3066"
415
+ t.string "english_name"
416
+ t.string "english_name_locale"
417
+ t.string "english_name_modifier"
418
+ t.string "native_name"
419
+ t.string "native_name_locale"
420
+ t.string "native_name_modifier"
421
+ t.boolean "macro_language"
422
+ t.string "direction"
423
+ t.string "pluralization"
424
+ t.string "scope", limit: 1
425
+ end
426
+
427
+ add_index "globalize_languages", ["iso_639_1"], name: "index_globalize_languages_on_iso_639_1"
428
+ add_index "globalize_languages", ["iso_639_2"], name: "index_globalize_languages_on_iso_639_2"
429
+ add_index "globalize_languages", ["iso_639_3"], name: "index_globalize_languages_on_iso_639_3"
430
+ add_index "globalize_languages", ["rfc_3066"], name: "index_globalize_languages_on_rfc_3066"
431
+
432
+ create_table "preferences", force: :cascade do |t|
433
+ t.string "name", null: false
434
+ t.integer "owner_id", null: false
435
+ t.string "owner_type", null: false
436
+ t.integer "group_id"
437
+ t.string "group_type"
438
+ t.string "value"
439
+ t.datetime "created_at"
440
+ t.datetime "updated_at"
441
+ end
442
+
443
+ add_index "preferences", ["owner_id", "owner_type", "name", "group_id", "group_type"], name: "index_preferences_on_owner_and_name_and_preference", unique: true
444
+
445
+ create_table "roles", force: :cascade do |t|
446
+ t.string "name"
447
+ t.integer "resource_id"
448
+ t.string "resource_type"
449
+ t.datetime "created_at"
450
+ t.datetime "updated_at"
451
+ t.integer "account_id"
452
+ end
453
+
454
+ add_index "roles", ["account_id"], name: "index_roles_on_account_id"
455
+ add_index "roles", ["name", "resource_type", "resource_id"], name: "index_roles_on_name_and_resource_type_and_resource_id"
456
+ add_index "roles", ["name"], name: "index_roles_on_name"
457
+
458
+ create_table "taggings", force: :cascade do |t|
459
+ t.integer "tag_id"
460
+ t.integer "taggable_id"
461
+ t.string "taggable_type"
462
+ t.integer "tagger_id"
463
+ t.string "tagger_type"
464
+ t.string "context", limit: 128
465
+ t.datetime "created_at"
466
+ end
467
+
468
+ add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true
469
+ add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context"
470
+
471
+ create_table "tags", force: :cascade do |t|
472
+ t.string "name"
473
+ t.integer "taggings_count", default: 0
474
+ end
475
+
476
+ add_index "tags", ["name"], name: "index_tags_on_name", unique: true
477
+
478
+ create_table "user_profiles", force: :cascade do |t|
479
+ t.integer "user_id"
480
+ t.string "public_name", limit: 50, default: ""
481
+ t.string "first_name", limit: 50, default: ""
482
+ t.string "last_name", limit: 50, default: ""
483
+ t.string "address", limit: 70, default: ""
484
+ t.string "address2", limit: 70, default: ""
485
+ t.string "city", limit: 30, default: ""
486
+ t.string "state", limit: 30, default: ""
487
+ t.string "zipcode", limit: 10, default: ""
488
+ t.integer "country_id", default: 0
489
+ t.string "phone", limit: 20, default: ""
490
+ t.string "cell", limit: 20, default: ""
491
+ t.string "fax", limit: 20, default: ""
492
+ t.string "workphone", limit: 20, default: ""
493
+ t.string "website", limit: 50, default: ""
494
+ t.string "gender", limit: 1, default: ""
495
+ t.integer "status", default: 0
496
+ t.integer "lock_version", default: 0
497
+ t.datetime "created_at"
498
+ t.datetime "updated_at"
499
+ t.integer "account_id"
500
+ t.string "email"
501
+ t.string "public_avatar"
502
+ t.integer "public_avatar_file_size"
503
+ t.string "public_avatar_content_type"
504
+ t.string "private_avatar"
505
+ t.integer "private_avatar_file_size"
506
+ t.string "private_avatar_content_type"
507
+ t.boolean "use_private_avatar_for_public", default: false
508
+ t.string "favored_locale"
509
+ end
510
+
511
+ create_table "user_site_profiles", force: :cascade do |t|
512
+ t.integer "user_id"
513
+ t.datetime "last_access_at"
514
+ t.datetime "created_at"
515
+ t.datetime "updated_at"
516
+ t.integer "account_id"
517
+ t.string "uuid", limit: 40
518
+ end
519
+
520
+ add_index "user_site_profiles", ["uuid"], name: "index_user_site_profiles_on_uuid"
521
+
522
+ create_table "users", force: :cascade do |t|
523
+ t.string "email", default: "", null: false
524
+ t.string "encrypted_password", default: "", null: false
525
+ t.string "reset_password_token"
526
+ t.datetime "reset_password_sent_at"
527
+ t.datetime "remember_created_at"
528
+ t.integer "sign_in_count", default: 0
529
+ t.datetime "current_sign_in_at"
530
+ t.datetime "last_sign_in_at"
531
+ t.string "current_sign_in_ip"
532
+ t.string "last_sign_in_ip"
533
+ t.string "confirmation_token"
534
+ t.datetime "confirmed_at"
535
+ t.datetime "confirmation_sent_at"
536
+ t.string "unconfirmed_email"
537
+ t.datetime "created_at"
538
+ t.datetime "updated_at"
539
+ t.integer "account_id"
540
+ end
541
+
542
+ add_index "users", ["account_id"], name: "index_users_on_account_id"
543
+ add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
544
+ add_index "users", ["email"], name: "index_users_on_email", unique: true
545
+ add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
546
+
547
+ create_table "users_roles", id: false, force: :cascade do |t|
548
+ t.integer "user_id"
549
+ t.integer "role_id"
550
+ end
551
+
552
+ add_index "users_roles", ["user_id", "role_id"], name: "index_users_roles_on_user_id_and_role_id"
553
+
554
+ create_table "version_associations", force: :cascade do |t|
555
+ t.integer "version_id"
556
+ t.string "foreign_key_name", null: false
557
+ t.integer "foreign_key_id"
558
+ end
559
+
560
+ add_index "version_associations", ["foreign_key_name", "foreign_key_id"], name: "index_version_associations_on_foreign_key"
561
+ add_index "version_associations", ["version_id"], name: "index_version_associations_on_version_id"
562
+
563
+ create_table "versions", force: :cascade do |t|
564
+ t.string "item_type", null: false
565
+ t.integer "item_id", null: false
566
+ t.string "event", null: false
567
+ t.string "whodunnit"
568
+ t.text "object", limit: 1073741823
569
+ t.datetime "created_at"
570
+ t.text "object_changes", limit: 1073741823
571
+ t.string "locale"
572
+ t.integer "transaction_id"
573
+ end
574
+
575
+ add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
576
+ add_index "versions", ["transaction_id"], name: "index_versions_on_transaction_id"
577
+
578
+ create_table "votes", force: :cascade do |t|
579
+ t.integer "votable_id"
580
+ t.string "votable_type"
581
+ t.integer "voter_id"
582
+ t.string "voter_type"
583
+ t.boolean "vote_flag"
584
+ t.string "vote_scope"
585
+ t.integer "vote_weight"
586
+ t.datetime "created_at"
587
+ t.datetime "updated_at"
588
+ end
589
+
590
+ add_index "votes", ["votable_id", "votable_type", "vote_scope"], name: "index_votes_on_votable_id_and_votable_type_and_vote_scope"
591
+ add_index "votes", ["voter_id", "voter_type", "vote_scope"], name: "index_votes_on_voter_id_and_voter_type_and_vote_scope"
592
+
593
+ end