cas-cms 0.1.0

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 (126) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +43 -0
  4. data/Rakefile +37 -0
  5. data/app/assets/config/cas_manifest.js +2 -0
  6. data/app/assets/images/cas/black-star.svg +4 -0
  7. data/app/assets/images/cas/check.svg +4 -0
  8. data/app/assets/images/cas/dropzone-in.svg +4 -0
  9. data/app/assets/images/cas/loading.gif +0 -0
  10. data/app/assets/images/cas/white-star.svg +4 -0
  11. data/app/assets/javascripts/cas/application.js +51 -0
  12. data/app/assets/javascripts/cas/fileupload_manifest.js +269 -0
  13. data/app/assets/javascripts/cas/plugins/cas_image_gallery.js +353 -0
  14. data/app/assets/javascripts/cas/vendor/file_upload/canvas-to-blob.min.js +2 -0
  15. data/app/assets/javascripts/cas/vendor/file_upload/jquery.fileupload-image.js +326 -0
  16. data/app/assets/javascripts/cas/vendor/file_upload/jquery.fileupload-process.js +178 -0
  17. data/app/assets/javascripts/cas/vendor/file_upload/jquery.fileupload.js +1482 -0
  18. data/app/assets/javascripts/cas/vendor/file_upload/jquery.iframe-transport.js +224 -0
  19. data/app/assets/javascripts/cas/vendor/file_upload/jquery.ui.widget.js +572 -0
  20. data/app/assets/javascripts/cas/vendor/file_upload/load-image.all.min.js +2 -0
  21. data/app/assets/javascripts/cas/vendor/jquery.ui.touch-punch.min.js +11 -0
  22. data/app/assets/javascripts/cas/vendor/selectize.min.js +3 -0
  23. data/app/assets/stylesheets/cas/application.sass +17 -0
  24. data/app/assets/stylesheets/cas/colors.sass +6 -0
  25. data/app/assets/stylesheets/cas/form.sass +99 -0
  26. data/app/assets/stylesheets/cas/layout.sass +68 -0
  27. data/app/assets/stylesheets/cas/mixins.sass +34 -0
  28. data/app/assets/stylesheets/cas/plugins/attachments_form.sass +16 -0
  29. data/app/assets/stylesheets/cas/plugins/image_gallery.sass +128 -0
  30. data/app/assets/stylesheets/cas/tables.sass +13 -0
  31. data/app/assets/stylesheets/cas/typography.sass +27 -0
  32. data/app/assets/stylesheets/cas/vendors/selectize.default.css +394 -0
  33. data/app/assets/stylesheets/cas/vendors/simplegrid.css +298 -0
  34. data/app/controllers/cas/api/files_controller.rb +88 -0
  35. data/app/controllers/cas/application_controller.rb +17 -0
  36. data/app/controllers/cas/devise/sessions_controller.rb +9 -0
  37. data/app/controllers/cas/file_uploads_controller.rb +14 -0
  38. data/app/controllers/cas/sections/application_controller.rb +23 -0
  39. data/app/controllers/cas/sections/categories_controller.rb +47 -0
  40. data/app/controllers/cas/sections/contents_controller.rb +144 -0
  41. data/app/controllers/cas/sections_controller.rb +7 -0
  42. data/app/controllers/cas/users_controller.rb +61 -0
  43. data/app/helpers/cas/application_helper.rb +4 -0
  44. data/app/helpers/cas/form_helper.rb +11 -0
  45. data/app/jobs/cas/application_job.rb +4 -0
  46. data/app/jobs/cas/images/delete_job.rb +11 -0
  47. data/app/jobs/cas/images/promote_job.rb +11 -0
  48. data/app/jobs/cas/increment_pageviews_job.rb +11 -0
  49. data/app/models/cas/application_record.rb +5 -0
  50. data/app/models/cas/category.rb +6 -0
  51. data/app/models/cas/content.rb +59 -0
  52. data/app/models/cas/media_file.rb +77 -0
  53. data/app/models/cas/section.rb +10 -0
  54. data/app/models/cas/site.rb +5 -0
  55. data/app/models/cas/user.rb +39 -0
  56. data/app/uploaders/file_uploader.rb +26 -0
  57. data/app/views/cas/devise/sessions/new.html.erb +24 -0
  58. data/app/views/cas/sections/categories/_form.html.erb +19 -0
  59. data/app/views/cas/sections/categories/edit.html.erb +5 -0
  60. data/app/views/cas/sections/categories/index.html.erb +28 -0
  61. data/app/views/cas/sections/categories/new.html.erb +5 -0
  62. data/app/views/cas/sections/contents/_form_attachments.html.erb +42 -0
  63. data/app/views/cas/sections/contents/_form_attachments_template.html.erb +11 -0
  64. data/app/views/cas/sections/contents/_form_for_content.html.erb +85 -0
  65. data/app/views/cas/sections/contents/_form_for_survey.html.erb +36 -0
  66. data/app/views/cas/sections/contents/_form_images.html.erb +86 -0
  67. data/app/views/cas/sections/contents/edit.html.erb +6 -0
  68. data/app/views/cas/sections/contents/index.html.erb +71 -0
  69. data/app/views/cas/sections/contents/new.html.erb +5 -0
  70. data/app/views/cas/sections/index.html.erb +21 -0
  71. data/app/views/cas/shared/_error_messages.html.erb +12 -0
  72. data/app/views/cas/users/_form.html.erb +11 -0
  73. data/app/views/cas/users/edit.html.erb +2 -0
  74. data/app/views/cas/users/index.html.erb +34 -0
  75. data/app/views/cas/users/new.html.erb +2 -0
  76. data/app/views/layouts/cas/application.html.erb +71 -0
  77. data/config/initializers/acts_as_taggable.rb +1 -0
  78. data/config/initializers/devise.rb +277 -0
  79. data/config/initializers/shrine.rb +50 -0
  80. data/config/initializers/simple_form.rb +169 -0
  81. data/config/locales/devise.en.yml +64 -0
  82. data/config/locales/pt-BR.yml +242 -0
  83. data/config/locales/simple_form.en.yml +31 -0
  84. data/config/routes.rb +31 -0
  85. data/db/migrate/20170129212144_create_cas_sites.rb +15 -0
  86. data/db/migrate/20170219172958_create_cas_sections.rb +12 -0
  87. data/db/migrate/20170219175007_create_cas_contents.rb +17 -0
  88. data/db/migrate/20170612204500_create_cas_users.rb +14 -0
  89. data/db/migrate/20170613174724_create_cas_media_files.rb +20 -0
  90. data/db/migrate/20170613175912_create_cas_categories.rb +14 -0
  91. data/db/migrate/20170614171928_add_columns_to_cas_contents.rb +12 -0
  92. data/db/migrate/20170614172904_add_column_to_cas_sections.rb +6 -0
  93. data/db/migrate/20170615235532_add_devise_to_cas_users.rb +49 -0
  94. data/db/migrate/20170616011202_remove_password_from_cas_users.rb +5 -0
  95. data/db/migrate/20170618014204_v3_migration_fields.rb +30 -0
  96. data/db/migrate/20170623182702_add_column_category_id_to_cas_content.rb +6 -0
  97. data/db/migrate/20170624024648_rename_url_to_path_in_files.rb +7 -0
  98. data/db/migrate/20170625192119_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +36 -0
  99. data/db/migrate/20170625192120_add_missing_unique_indices.acts_as_taggable_on_engine.rb +26 -0
  100. data/db/migrate/20170625192121_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +20 -0
  101. data/db/migrate/20170625192122_add_missing_taggable_index.acts_as_taggable_on_engine.rb +15 -0
  102. data/db/migrate/20170625192123_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +15 -0
  103. data/db/migrate/20170625192124_add_missing_indexes_on_taggings.acts_as_taggable_on_engine.rb +23 -0
  104. data/db/migrate/20170713210101_add_location_to_cas_content.rb +5 -0
  105. data/db/migrate/20170714043036_add_url_to_content.rb +5 -0
  106. data/db/migrate/20170718201535_add_embedded_to_content.rb +5 -0
  107. data/db/migrate/20170801171952_categories_with_jsonb_metadata.rb +6 -0
  108. data/db/migrate/20170801173256_add_published_at_to_cas_contents.rb +6 -0
  109. data/db/migrate/20170801175407_add_description_to_cas_categories.rb +5 -0
  110. data/db/migrate/20170830000000_add_data_search_extensions.rb +17 -0
  111. data/db/migrate/20170830000001_add_search_index_to_cas_contents.rb +20 -0
  112. data/db/migrate/20170830000002_use_uuid_with_acts_as_taggable_references.rb +17 -0
  113. data/db/migrate/20170919181809_pageviews_default_to_zero.rb +9 -0
  114. data/db/migrate/20171201191059_add_domains_to_cas_site.rb +6 -0
  115. data/lib/cas.rb +22 -0
  116. data/lib/cas/config.rb +42 -0
  117. data/lib/cas/engine.rb +33 -0
  118. data/lib/cas/form_field.rb +54 -0
  119. data/lib/cas/remote_callbacks.rb +36 -0
  120. data/lib/cas/section_config.rb +84 -0
  121. data/lib/cas/setup.rb +43 -0
  122. data/lib/cas/version.rb +3 -0
  123. data/lib/devise/custom_failure.rb +16 -0
  124. data/lib/tasks/cas_tasks.rake +4 -0
  125. data/lib/templates/erb/scaffold/_form.html.erb +13 -0
  126. metadata +560 -0
@@ -0,0 +1,31 @@
1
+ en:
2
+ simple_form:
3
+ "yes": 'Yes'
4
+ "no": 'No'
5
+ required:
6
+ text: 'required'
7
+ mark: '*'
8
+ # You can uncomment the line below if you need to overwrite the whole required html.
9
+ # When using html, text and mark won't be used.
10
+ # html: '<abbr title="required">*</abbr>'
11
+ error_notification:
12
+ default_message: "Please review the problems below:"
13
+ # Examples
14
+ # labels:
15
+ # defaults:
16
+ # password: 'Password'
17
+ # user:
18
+ # new:
19
+ # email: 'E-mail to sign in.'
20
+ # edit:
21
+ # email: 'E-mail.'
22
+ # hints:
23
+ # defaults:
24
+ # username: 'User name to sign in.'
25
+ # password: 'No special characters, please.'
26
+ # include_blanks:
27
+ # defaults:
28
+ # age: 'Rather not say'
29
+ # prompts:
30
+ # defaults:
31
+ # age: 'Select your age'
@@ -0,0 +1,31 @@
1
+ require 'sidekiq/web'
2
+ Sidekiq::Web.set :session_secret, Rails.application.secrets[:secret_key_base]
3
+
4
+ Cas::Engine.routes.draw do
5
+ mount Shrine.presign_endpoint(:cache) => "/files/cache/presign"
6
+
7
+ authenticate :user, ->(u){ u.roles.include?('admin') } do
8
+ mount Sidekiq::Web => '/sidekiq'
9
+ end
10
+
11
+ devise_for :users,
12
+ class_name: "Cas::User",
13
+ module: :devise,
14
+ controllers: { sessions: "cas/devise/sessions" },
15
+ skip: :registrations
16
+
17
+ resources :users, controller: 'users'
18
+
19
+ resources :sections, only: [:index] do
20
+ resources :contents, controller: 'sections/contents'
21
+ resources :categories, controller: 'sections/categories'
22
+ end
23
+
24
+ # used by tinymce editor
25
+ resources :file_uploads, only: :create
26
+ namespace :api, module: "api" do
27
+ resources :files, only: [:create, :destroy]
28
+ end
29
+
30
+ root 'sections#index'
31
+ end
@@ -0,0 +1,15 @@
1
+ class CreateCasSites < ActiveRecord::Migration[5.0]
2
+ def change
3
+ reversible do |dir|
4
+ dir.up do
5
+ enable_extension "uuid-ossp"
6
+ end
7
+ end
8
+
9
+ create_table :cas_sites, id: :uuid do |t|
10
+ t.string :name
11
+ t.timestamps
12
+ end
13
+ add_index :cas_sites, :name
14
+ end
15
+ end
@@ -0,0 +1,12 @@
1
+ class CreateCasSections < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :cas_sections, id: :uuid do |t|
4
+ t.string :name, null: false
5
+ t.string :section_type, null: false
6
+ t.column :site_id, :uuid
7
+
8
+ t.timestamps
9
+ end
10
+ add_index :cas_sections, :site_id
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ class CreateCasContents < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :cas_contents, id: :uuid do |t|
4
+ t.column :section_id, :uuid
5
+ t.string :title
6
+ t.text :text
7
+ t.column :author_id, :uuid
8
+ t.datetime :date
9
+ t.boolean :published
10
+
11
+ t.timestamps
12
+ end
13
+ add_index :cas_contents, :section_id
14
+ add_index :cas_contents, :author_id
15
+ add_index :cas_contents, :published
16
+ end
17
+ end
@@ -0,0 +1,14 @@
1
+ class CreateCasUsers < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :cas_users, id: :uuid do |t|
4
+ t.string :name, null: false
5
+ t.string :login
6
+ t.string :password, null: false
7
+ t.uuid :author_id
8
+ t.string :roles, array: true, default: []
9
+
10
+ t.timestamps
11
+ end
12
+ add_index :cas_users, :author_id
13
+ end
14
+ end
@@ -0,0 +1,20 @@
1
+ class CreateCasMediaFiles < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :cas_media_files, id: :uuid do |t|
4
+ t.uuid :attachable_id, polymorphic: true
5
+ t.string :attachable_type, polymorphic: true
6
+ t.uuid :author_id, null: false
7
+ t.string :service, null: false
8
+ t.text :title
9
+ t.string :url
10
+ t.string :mime_type
11
+ t.string :original_name
12
+ t.integer :size
13
+ t.text :file_data
14
+
15
+ t.timestamps
16
+ end
17
+ add_index :cas_media_files, :author_id
18
+ add_index :cas_media_files, [:attachable_id, :attachable_type]
19
+ end
20
+ end
@@ -0,0 +1,14 @@
1
+ class CreateCasCategories < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :cas_categories, id: :uuid do |t|
4
+ t.uuid :section_id, null: false
5
+ t.string :name, null: false
6
+ t.string :slug
7
+ t.jsonb :metadata, default: '{}'
8
+
9
+ t.timestamps
10
+ end
11
+ add_index :cas_categories, :section_id
12
+ add_index :cas_categories, :slug
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ class AddColumnsToCasContents < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :cas_contents, :pageviews, :integer
4
+ add_column :cas_contents, :metadata, :jsonb, default: '{}'
5
+ add_column :cas_contents, :summary, :text
6
+ add_column :cas_contents, :details, :jsonb, default: '{}'
7
+ add_column :cas_contents, :slug, :string
8
+ change_column :cas_contents, :section_id, :uuid, null: false
9
+ change_column :cas_contents, :author_id, :uuid, null: false
10
+ add_index :cas_contents, :slug
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ class AddColumnToCasSections < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :cas_sections, :slug, :string
4
+ add_index :cas_sections, :slug
5
+ end
6
+ end
@@ -0,0 +1,49 @@
1
+ class AddDeviseToCasUsers < ActiveRecord::Migration[5.0]
2
+ def self.up
3
+ change_table :cas_users do |t|
4
+ ## Database authenticatable
5
+ t.string :email, null: false, default: ""
6
+ t.string :encrypted_password, null: false, default: ""
7
+
8
+ ## Recoverable
9
+ t.string :reset_password_token
10
+ t.datetime :reset_password_sent_at
11
+
12
+ ## Rememberable
13
+ t.datetime :remember_created_at
14
+
15
+ ## Trackable
16
+ t.integer :sign_in_count, default: 0, null: false
17
+ t.datetime :current_sign_in_at
18
+ t.datetime :last_sign_in_at
19
+ t.string :current_sign_in_ip
20
+ t.string :last_sign_in_ip
21
+
22
+ ## Confirmable
23
+ # t.string :confirmation_token
24
+ # t.datetime :confirmed_at
25
+ # t.datetime :confirmation_sent_at
26
+ # t.string :unconfirmed_email # Only if using reconfirmable
27
+
28
+ ## Lockable
29
+ # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
30
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
31
+ # t.datetime :locked_at
32
+
33
+
34
+ # Uncomment below if timestamps were not included in your original model.
35
+ # t.timestamps null: false
36
+ end
37
+
38
+ add_index :cas_users, :email, unique: true
39
+ add_index :cas_users, :reset_password_token, unique: true
40
+ # add_index :cas_users, :confirmation_token, unique: true
41
+ # add_index :cas_users, :unlock_token, unique: true
42
+ end
43
+
44
+ def self.down
45
+ # By default, we don't want to make any assumption about how to roll back a migration when your
46
+ # model already existed. Please edit below which fields you would like to remove in this migration.
47
+ raise ActiveRecord::IrreversibleMigration
48
+ end
49
+ end
@@ -0,0 +1,5 @@
1
+ class RemovePasswordFromCasUsers < ActiveRecord::Migration[5.0]
2
+ def change
3
+ remove_column :cas_users, :password, :string, index: true
4
+ end
5
+ end
@@ -0,0 +1,30 @@
1
+ class V3MigrationFields < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :cas_sites, :slug, :string
4
+ add_column :cas_users, :metadata, :jsonb, default: {}
5
+ add_column :cas_media_files, :cover, :boolean, null: false, default: false
6
+ add_column :cas_media_files, :order, :integer, default: 1
7
+ add_column :cas_media_files, :text, :text
8
+ add_column :cas_media_files, :metadata, :jsonb, default: {}
9
+
10
+ reversible do |dir|
11
+ dir.up do
12
+ change_column :cas_users,
13
+ :email,
14
+ :string,
15
+ null: true,
16
+ default: nil
17
+ change_column :cas_media_files,
18
+ :author_id,
19
+ :uuid,
20
+ null: true
21
+ end
22
+ dir.down do
23
+ end
24
+ end
25
+
26
+ add_index :cas_sites, :slug
27
+ add_index :cas_users, :encrypted_password
28
+ add_index :cas_media_files, :cover
29
+ end
30
+ end
@@ -0,0 +1,6 @@
1
+ class AddColumnCategoryIdToCasContent < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :cas_contents, :category_id, :uuid
4
+ add_index :cas_contents, :category_id
5
+ end
6
+ end
@@ -0,0 +1,7 @@
1
+ class RenameUrlToPathInFiles < ActiveRecord::Migration[5.0]
2
+ def change
3
+ rename_column :cas_media_files, :url, :path
4
+ rename_column :cas_media_files, :title, :description
5
+ add_column :cas_media_files, :media_type, :string, null: false
6
+ end
7
+ end
@@ -0,0 +1,36 @@
1
+ # This migration comes from acts_as_taggable_on_engine (originally 1)
2
+ if ActiveRecord.gem_version >= Gem::Version.new('5.0')
3
+ class ActsAsTaggableOnMigration < ActiveRecord::Migration[4.2]; end
4
+ else
5
+ class ActsAsTaggableOnMigration < ActiveRecord::Migration; end
6
+ end
7
+ ActsAsTaggableOnMigration.class_eval do
8
+ def self.up
9
+ create_table :tags do |t|
10
+ t.string :name
11
+ end
12
+
13
+ create_table :taggings do |t|
14
+ t.references :tag
15
+
16
+ # You should make sure that the column created is
17
+ # long enough to store the required class names.
18
+ t.references :taggable, polymorphic: true
19
+ t.references :tagger, polymorphic: true
20
+
21
+ # Limit is created to prevent MySQL error on index
22
+ # length for MyISAM table type: http://bit.ly/vgW2Ql
23
+ t.string :context, limit: 128
24
+
25
+ t.datetime :created_at
26
+ end
27
+
28
+ add_index :taggings, :tag_id
29
+ add_index :taggings, [:taggable_id, :taggable_type, :context]
30
+ end
31
+
32
+ def self.down
33
+ drop_table :taggings
34
+ drop_table :tags
35
+ end
36
+ end
@@ -0,0 +1,26 @@
1
+ # This migration comes from acts_as_taggable_on_engine (originally 2)
2
+ if ActiveRecord.gem_version >= Gem::Version.new('5.0')
3
+ class AddMissingUniqueIndices < ActiveRecord::Migration[4.2]; end
4
+ else
5
+ class AddMissingUniqueIndices < ActiveRecord::Migration; end
6
+ end
7
+ AddMissingUniqueIndices.class_eval do
8
+ def self.up
9
+ add_index :tags, :name, unique: true
10
+
11
+ remove_index :taggings, :tag_id if index_exists?(:taggings, :tag_id)
12
+ remove_index :taggings, [:taggable_id, :taggable_type, :context]
13
+ add_index :taggings,
14
+ [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type],
15
+ unique: true, name: 'taggings_idx'
16
+ end
17
+
18
+ def self.down
19
+ remove_index :tags, :name
20
+
21
+ remove_index :taggings, name: 'taggings_idx'
22
+
23
+ add_index :taggings, :tag_id unless index_exists?(:taggings, :tag_id)
24
+ add_index :taggings, [:taggable_id, :taggable_type, :context]
25
+ end
26
+ end
@@ -0,0 +1,20 @@
1
+ # This migration comes from acts_as_taggable_on_engine (originally 3)
2
+ if ActiveRecord.gem_version >= Gem::Version.new('5.0')
3
+ class AddTaggingsCounterCacheToTags < ActiveRecord::Migration[4.2]; end
4
+ else
5
+ class AddTaggingsCounterCacheToTags < ActiveRecord::Migration; end
6
+ end
7
+ AddTaggingsCounterCacheToTags.class_eval do
8
+ def self.up
9
+ add_column :tags, :taggings_count, :integer, default: 0
10
+
11
+ ActsAsTaggableOn::Tag.reset_column_information
12
+ ActsAsTaggableOn::Tag.find_each do |tag|
13
+ ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings)
14
+ end
15
+ end
16
+
17
+ def self.down
18
+ remove_column :tags, :taggings_count
19
+ end
20
+ end
@@ -0,0 +1,15 @@
1
+ # This migration comes from acts_as_taggable_on_engine (originally 4)
2
+ if ActiveRecord.gem_version >= Gem::Version.new('5.0')
3
+ class AddMissingTaggableIndex < ActiveRecord::Migration[4.2]; end
4
+ else
5
+ class AddMissingTaggableIndex < ActiveRecord::Migration; end
6
+ end
7
+ AddMissingTaggableIndex.class_eval do
8
+ def self.up
9
+ add_index :taggings, [:taggable_id, :taggable_type, :context]
10
+ end
11
+
12
+ def self.down
13
+ remove_index :taggings, [:taggable_id, :taggable_type, :context]
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # This migration comes from acts_as_taggable_on_engine (originally 5)
2
+ # This migration is added to circumvent issue #623 and have special characters
3
+ # work properly
4
+ if ActiveRecord.gem_version >= Gem::Version.new('5.0')
5
+ class ChangeCollationForTagNames < ActiveRecord::Migration[4.2]; end
6
+ else
7
+ class ChangeCollationForTagNames < ActiveRecord::Migration; end
8
+ end
9
+ ChangeCollationForTagNames.class_eval do
10
+ def up
11
+ if ActsAsTaggableOn::Utils.using_mysql?
12
+ execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;")
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,23 @@
1
+ # This migration comes from acts_as_taggable_on_engine (originally 6)
2
+ if ActiveRecord.gem_version >= Gem::Version.new('5.0')
3
+ class AddMissingIndexesOnTaggings < ActiveRecord::Migration[4.2]; end
4
+ else
5
+ class AddMissingIndexesOnTaggings < ActiveRecord::Migration; end
6
+ end
7
+ AddMissingIndexesOnTaggings.class_eval do
8
+ def change
9
+ add_index :taggings, :tag_id unless index_exists? :taggings, :tag_id
10
+ add_index :taggings, :taggable_id unless index_exists? :taggings, :taggable_id
11
+ add_index :taggings, :taggable_type unless index_exists? :taggings, :taggable_type
12
+ add_index :taggings, :tagger_id unless index_exists? :taggings, :tagger_id
13
+ add_index :taggings, :context unless index_exists? :taggings, :context
14
+
15
+ unless index_exists? :taggings, [:tagger_id, :tagger_type]
16
+ add_index :taggings, [:tagger_id, :tagger_type]
17
+ end
18
+
19
+ unless index_exists? :taggings, [:taggable_id, :taggable_type, :tagger_id, :context], name: 'taggings_idy'
20
+ add_index :taggings, [:taggable_id, :taggable_type, :tagger_id, :context], name: 'taggings_idy'
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ class AddLocationToCasContent < ActiveRecord::Migration[5.0]
2
+ def change
3
+ add_column :cas_contents, :location, :string
4
+ end
5
+ end