bcms_aws_s3-artirix 4.0.0.rc1.art4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +36 -0
  3. data/app/assets/javascripts/bcms_s3/application.js +13 -0
  4. data/app/assets/stylesheets/bcms_s3/application.css +13 -0
  5. data/app/controllers/bcms_s3/application_controller.rb +4 -0
  6. data/app/helpers/bcms_s3/application_helper.rb +4 -0
  7. data/app/views/layouts/bcms_s3/application.html.erb +14 -0
  8. data/config/routes.rb +2 -0
  9. data/lib/bcms_aws_s3-artirix.rb +1 -0
  10. data/lib/bcms_aws_s3.rb +4 -0
  11. data/lib/bcms_s3/engine.rb +31 -0
  12. data/lib/bcms_s3/s3_module.rb +24 -0
  13. data/lib/bcms_s3/version.rb +3 -0
  14. data/lib/cms/attachments/s3_strategy.rb +31 -0
  15. data/lib/generators/bcms_s3/install/USAGE +3 -0
  16. data/lib/generators/bcms_s3/install/install_generator.rb +21 -0
  17. data/lib/tasks/bcms_s3_tasks.rake +4 -0
  18. data/test/bcms_s3_test.rb +7 -0
  19. data/test/dummy/README.rdoc +28 -0
  20. data/test/dummy/Rakefile +6 -0
  21. data/test/dummy/app/assets/javascripts/application.js +13 -0
  22. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  23. data/test/dummy/app/controllers/application_controller.rb +5 -0
  24. data/test/dummy/app/helpers/application_helper.rb +2 -0
  25. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  26. data/test/dummy/app/views/layouts/templates/default.html.erb +16 -0
  27. data/test/dummy/bin/bundle +3 -0
  28. data/test/dummy/bin/rails +4 -0
  29. data/test/dummy/bin/rake +4 -0
  30. data/test/dummy/config.ru +4 -0
  31. data/test/dummy/config/application.rb +23 -0
  32. data/test/dummy/config/boot.rb +5 -0
  33. data/test/dummy/config/database.yml +25 -0
  34. data/test/dummy/config/environment.rb +5 -0
  35. data/test/dummy/config/environments/development.rb +29 -0
  36. data/test/dummy/config/environments/production.rb +86 -0
  37. data/test/dummy/config/environments/test.rb +36 -0
  38. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  39. data/test/dummy/config/initializers/browsercms.rb +1 -0
  40. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  41. data/test/dummy/config/initializers/inflections.rb +16 -0
  42. data/test/dummy/config/initializers/mime_types.rb +5 -0
  43. data/test/dummy/config/initializers/secret_token.rb +12 -0
  44. data/test/dummy/config/initializers/session_store.rb +3 -0
  45. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  46. data/test/dummy/config/locales/en.yml +23 -0
  47. data/test/dummy/config/routes.rb +6 -0
  48. data/test/dummy/config/s3.yml +2 -0
  49. data/test/dummy/db/browsercms.seeds.rb +59 -0
  50. data/test/dummy/db/migrate/20140204192558_browsercms300.cms.rb +288 -0
  51. data/test/dummy/db/migrate/20140204192559_browsercms400.cms.rb +91 -0
  52. data/test/dummy/db/migrate/20140204192560_devise_create_users.cms.rb +48 -0
  53. data/test/dummy/db/migrate/20140204192561_kill_reset_password.cms.rb +6 -0
  54. data/test/dummy/db/migrate/20140204192562_create_cms_external_users.cms.rb +11 -0
  55. data/test/dummy/db/schema.rb +558 -0
  56. data/test/dummy/db/seeds.rb +3 -0
  57. data/test/dummy/db/test.sqlite3 +0 -0
  58. data/test/dummy/log/test.log +5 -0
  59. data/test/dummy/public/404.html +58 -0
  60. data/test/dummy/public/422.html +58 -0
  61. data/test/dummy/public/500.html +57 -0
  62. data/test/dummy/public/favicon.ico +0 -0
  63. data/test/integration/navigation_test.rb +10 -0
  64. data/test/test_helper.rb +15 -0
  65. metadata +198 -0
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Dummy::Application.initialize!
@@ -0,0 +1,29 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports and disable caching.
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send.
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+ # Raise an error on page load if there are pending migrations
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
29
+ end
@@ -0,0 +1,86 @@
1
+ Dummy::Application.configure do
2
+ # Uncomment and set this to match your production URL. Used for emailing links to the CMS. (default: localhost:3000)
3
+ # config.cms.site_domain = "www.example.com"
4
+
5
+ # Configure your mail server's address below
6
+ config.action_mailer.smtp_settings = {:address => 'mail.yourmailserver.com', :domain => config.cms.site_domain}
7
+
8
+ # Settings specified here will take precedence over those in config/application.rb.
9
+
10
+ # Code is not reloaded between requests.
11
+ config.cache_classes = true
12
+
13
+ # Eager load code on boot. This eager loads most of Rails and
14
+ # your application in memory, allowing both thread web servers
15
+ # and those relying on copy on write to perform better.
16
+ # Rake tasks automatically ignore this option for performance.
17
+ config.eager_load = true
18
+
19
+ # Full error reports are disabled and caching is turned on.
20
+ config.consider_all_requests_local = false
21
+ config.action_controller.perform_caching = true
22
+
23
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
24
+ # Add `rack-cache` to your Gemfile before enabling this.
25
+ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
26
+ # config.action_dispatch.rack_cache = true
27
+
28
+ # Disable Rails's static asset server (Apache or nginx will already do this).
29
+ config.serve_static_assets = false
30
+
31
+ # Compress JavaScripts and CSS.
32
+ config.assets.js_compressor = :uglifier
33
+ # config.assets.css_compressor = :sass
34
+
35
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
36
+ config.assets.compile = true
37
+
38
+ # Generate digests for assets URLs.
39
+ config.assets.digest = true
40
+
41
+ # Version of your assets, change this if you want to expire all your assets.
42
+ config.assets.version = '1.0'
43
+
44
+ # Specifies the header that your server uses for sending files.
45
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
46
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
47
+
48
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
49
+ # config.force_ssl = true
50
+
51
+ # Set to :debug to see everything in the log.
52
+ config.log_level = :info
53
+
54
+ # Prepend all log lines with the following tags.
55
+ # config.log_tags = [ :subdomain, :uuid ]
56
+
57
+ # Use a different logger for distributed setups.
58
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
59
+
60
+ # Use a different cache store in production.
61
+ # config.cache_store = :mem_cache_store
62
+
63
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
64
+ # config.action_controller.asset_host = "http://assets.example.com"
65
+
66
+ # Precompile additional assets.
67
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
68
+ # config.assets.precompile += %w( search.js )
69
+
70
+ # Ignore bad email addresses and do not raise email delivery errors.
71
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
72
+ # config.action_mailer.raise_delivery_errors = false
73
+
74
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
75
+ # the I18n.default_locale when a translation can not be found).
76
+ config.i18n.fallbacks = true
77
+
78
+ # Send deprecation notices to registered listeners.
79
+ config.active_support.deprecation = :notify
80
+
81
+ # Disable automatic flushing of the log to improve performance.
82
+ # config.autoflush_log = false
83
+
84
+ # Use default logging formatter so that PID and timestamp are not suppressed.
85
+ config.log_formatter = ::Logger::Formatter.new
86
+ end
@@ -0,0 +1,36 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
14
+
15
+ # Configure static asset server for tests with Cache-Control for performance.
16
+ config.serve_static_assets = true
17
+ config.static_cache_control = "public, max-age=3600"
18
+
19
+ # Show full error reports and disable caching.
20
+ config.consider_all_requests_local = true
21
+ config.action_controller.perform_caching = false
22
+
23
+ # Raise exceptions instead of rendering exception templates.
24
+ config.action_dispatch.show_exceptions = false
25
+
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
28
+
29
+ # Tell Action Mailer not to deliver emails to the real world.
30
+ # The :test delivery method accumulates sent emails in the
31
+ # ActionMailer::Base.deliveries array.
32
+ config.action_mailer.delivery_method = :test
33
+
34
+ # Print deprecation notices to the stderr.
35
+ config.active_support.deprecation = :stderr
36
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1 @@
1
+ Cms.attachment_file_permission = 0640
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,12 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure your secret_key_base is kept private
11
+ # if you're sharing your code publicly.
12
+ Dummy::Application.config.secret_key_base = '4cd65b5ac4544434543e041ceb856f8563c7d2ca865b519328924f3810891eb7f7e43caae2eef502d2c79da13a2ba423241098938ffbc9c34864f09216a4ebdb'
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ hello: "Hello world"
@@ -0,0 +1,6 @@
1
+ Rails.application.routes.draw do
2
+
3
+ mount BcmsS3::Engine => "/bcms_s3"
4
+
5
+ mount_browsercms
6
+ end
@@ -0,0 +1,2 @@
1
+ access_key_id: AKIAJXWF53HAMDLRGSXA
2
+ secret_access_key: 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
@@ -0,0 +1,59 @@
1
+ require 'cms/data_loader'
2
+
3
+ if %w[development test dev local].include?(Rails.env)
4
+ pwd = "cmsadmin"
5
+ else
6
+ pwd = (0..8).inject("") { |s, i| s << (('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a).sample }
7
+ end
8
+ Cms::User.current = create_user(:cmsadmin, :login => "cmsadmin", :first_name => "CMS", :last_name => "Administrator", :email => "cmsadmin@example.com", :password => pwd, :password_confirmation => pwd)
9
+
10
+ create_permission(:administrate, :name => "administrate", :full_name => "Administer CMS", :description => "Allows users to administer the CMS, including adding users and groups.")
11
+ create_permission(:edit_content, :name => "edit_content", :full_name => "Edit Content", :description => "Allows users to Add, Edit and Delete both Pages and Blocks. Can Save (but not Publish) and Assign them as well.")
12
+ create_permission(:publish_content, :name => "publish_content", :full_name => "Publish Content", :description => "Allows users to Save and Publish, Hide and Archive both Pages and Blocks.")
13
+
14
+ create_group_type(:guest_group_type, :name => "Guest", :guest => true)
15
+ create_group_type(:registered_public_user, :name => "Registered Public User")
16
+ create_group_type(:cms_user, :name => "CMS User", :cms_access => true)
17
+
18
+ group_types(:cms_user).permissions<<permissions(:edit_content)
19
+ group_types(:cms_user).permissions<<permissions(:publish_content)
20
+
21
+ create_group(:guest, :name => 'Guest', :code => 'guest', :group_type => group_types(:guest_group_type))
22
+ create_group(:content_admin, :name => 'Cms Administrators', :code => 'cms-admin', :group_type => group_types(:cms_user))
23
+ create_group(:content_editor, :name => 'Content Editors', :code => 'content-editor', :group_type => group_types(:cms_user))
24
+ users(:cmsadmin).groups << groups(:content_admin)
25
+ users(:cmsadmin).groups << groups(:content_editor)
26
+
27
+ groups(:content_admin).permissions<<permissions(:administrate)
28
+ groups(:content_editor).permissions<<permissions(:edit_content)
29
+ groups(:content_editor).permissions<<permissions(:publish_content)
30
+
31
+ create_site(:default, :name => "Default", :domain => "example.com")
32
+ create_section(:root, :name => "My Site", :path => "/", :root => true)
33
+ create_section(:system, :name => "system", :parent => sections(:root), :path => "/system", :hidden => true)
34
+
35
+ Cms::Group.all.each { |g| g.sections = Cms::Section.all }
36
+
37
+ create_page(:home, :name => "Home", :path => "/", :section => sections(:root), :template_file_name => "default.html.erb", :cacheable => true)
38
+ create_page(:not_found, :name => "Page Not Found", :path => "/system/not_found", :section => sections(:system), :template_file_name => "default.html.erb", :publish_on_save => true, :hidden => true, :cacheable => true)
39
+ create_page(:access_denied, :name => "Access Denied", :path => "/system/access_denied", :section => sections(:system), :template_file_name => "default.html.erb", :publish_on_save => true, :hidden => true, :cacheable => true)
40
+ create_page(:server_error, :name => "Server Error", :path => "/system/server_error", :section => sections(:system), :template_file_name => "default.html.erb", :publish_on_save => true, :hidden => true, :cacheable => true)
41
+
42
+ create_html_block(:page_not_found, :name => "Page Not Found", :content => "<p>The page you tried to access does not exist on this server.</p>", :publish_on_save => true)
43
+ pages(:not_found).create_connector(html_blocks(:page_not_found), "main")
44
+ pages(:not_found).publish!
45
+
46
+ create_html_block(:access_denied, :name => "Access Denied", :content => "<p>You have tried to reach a resource or page which you do not have permission to view.</p>", :publish_on_save => true)
47
+ pages(:access_denied).create_connector(html_blocks(:access_denied), "main")
48
+ pages(:access_denied).publish!
49
+
50
+ create_html_block(:server_error, :name => "Server Error", :content => "<p>The server encountered an unexpected condition that prevented it from fulfilling the request.</p>", :publish_on_save => true)
51
+ pages(:server_error).create_connector(html_blocks(:server_error), "main")
52
+ pages(:server_error).publish!
53
+ pages(:home).publish!
54
+
55
+ unless Cms::DataLoader.silent_mode
56
+ puts "*************************************************"
57
+ puts "* YOUR CMS username/password is: cmsadmin/#{pwd}"
58
+ puts "*************************************************"
59
+ end
@@ -0,0 +1,288 @@
1
+ # This migration comes from cms (originally 20080815014337)
2
+ class Browsercms300 < ActiveRecord::Migration
3
+ def change
4
+ create_table :cms_users, :force => true do |t|
5
+ t.column :login, :string, :limit => 40
6
+ t.column :first_name, :string, :limit => 40
7
+ t.column :last_name, :string, :limit => 40
8
+ t.column :email, :string, :limit => 40
9
+ t.column :crypted_password, :string, :limit => 40
10
+ t.column :salt, :string, :limit => 40
11
+ t.column :created_at, :datetime
12
+ t.column :updated_at, :datetime
13
+ t.column :expires_at, :datetime
14
+ t.column :remember_token, :string, :limit => 40
15
+ t.column :remember_token_expires_at, :datetime
16
+ t.column :reset_token, :string
17
+ end
18
+ add_index :cms_users, :login, :unique => true
19
+
20
+ create_content_table :cms_dynamic_views do |t|
21
+ t.string :type
22
+ t.string :name
23
+ t.string :format
24
+ t.string :handler
25
+ t.text :body
26
+ t.timestamps
27
+ end
28
+
29
+ create_content_table :cms_pages do |t|
30
+ t.string :name
31
+ t.string :title
32
+ t.string :path
33
+ t.string :template_file_name
34
+ t.text :description
35
+ t.text :keywords
36
+ t.string :language
37
+ t.boolean :cacheable, :default => false
38
+ t.boolean :hidden, :default => false
39
+ end
40
+ add_column :cms_pages, :latest_version, :integer
41
+
42
+ create_table :cms_content_type_groups do |t|
43
+ t.string :name
44
+ t.timestamps
45
+ end
46
+
47
+ create_table :cms_content_types do |t|
48
+ t.string :name
49
+ t.belongs_to :content_type_group
50
+ t.integer :priority, :default => 2
51
+ t.timestamps
52
+ end
53
+
54
+ create_table :cms_category_types do |t|
55
+ t.string :name
56
+ t.timestamps
57
+ end
58
+
59
+ create_table :cms_categories do |t|
60
+ t.belongs_to :category_type
61
+ t.belongs_to :parent
62
+ t.string :name
63
+ t.timestamps
64
+ end
65
+
66
+ create_table :cms_connectors do |t|
67
+ t.integer :page_id
68
+ t.integer :page_version
69
+ t.integer :connectable_id
70
+ t.string :connectable_type
71
+ t.integer :connectable_version
72
+ t.string :container
73
+ t.integer :position
74
+ t.timestamps
75
+ end
76
+
77
+ create_content_table :cms_html_blocks do |t|
78
+ t.text :content, :limit => 64.kilobytes + 1
79
+ end
80
+
81
+ create_table :cms_sections do |t|
82
+ t.string :name
83
+ t.string :path
84
+ t.boolean :root, :default => false
85
+ t.boolean :hidden, :default => false
86
+ t.timestamps
87
+ end
88
+
89
+ create_table :cms_portlets do |t|
90
+ t.string :type
91
+ t.string :name
92
+ t.boolean :archived, :default => false
93
+ t.boolean :deleted, :default => false
94
+ t.integer :created_by_id, :updated_by_id
95
+ t.timestamps
96
+ end
97
+ create_table :cms_portlet_attributes do |t|
98
+ t.integer :portlet_id
99
+ t.string :name
100
+ t.text :value
101
+ end
102
+
103
+ create_table :cms_redirects do |t|
104
+ t.string :from_path
105
+ t.string :to_path
106
+ t.timestamps
107
+ end
108
+
109
+ create_content_table :cms_attachments, name: false do |t|
110
+ t.string :data_file_name
111
+ t.string :data_file_path
112
+ t.string :file_location
113
+ t.string :data_content_type
114
+ t.integer :data_file_size
115
+ t.string :data_fingerprint
116
+ t.string :attachable_type
117
+ t.string :attachment_name
118
+ t.integer :attachable_id
119
+ t.integer :attachable_version
120
+ t.string :cardinality
121
+ end
122
+
123
+ create_content_table :cms_file_blocks do |t|
124
+ t.string :type
125
+ t.string :name
126
+ t.integer :attachment_id
127
+ t.integer :attachment_version
128
+ end
129
+
130
+ create_table :cms_group_types do |t|
131
+ t.string :name
132
+ t.boolean :guest, :default => false
133
+ t.boolean :cms_access, :default => false
134
+ t.timestamps
135
+ end
136
+ create_table :cms_groups do |t|
137
+ t.string :name
138
+ t.string :code
139
+ t.integer :group_type_id
140
+ t.timestamps
141
+ end
142
+ create_table :cms_user_group_memberships do |t|
143
+ t.integer :user_id
144
+ t.integer :group_id
145
+ end
146
+
147
+ create_table :cms_permissions do |t|
148
+ t.string :name
149
+ t.string :full_name
150
+ t.string :description
151
+ t.string :for_module
152
+ t.timestamps
153
+ end
154
+ create_table :cms_group_permissions do |t|
155
+ t.integer :group_id
156
+ t.integer :permission_id
157
+ end
158
+ create_table :cms_group_type_permissions do |t|
159
+ t.integer :group_type_id
160
+ t.integer :permission_id
161
+ end
162
+ create_table :cms_group_sections do |t|
163
+ t.integer :group_id
164
+ t.integer :section_id
165
+ end
166
+
167
+ create_table :cms_sites do |t|
168
+ t.string :name
169
+ t.string :domain
170
+ t.boolean :the_default
171
+ t.timestamps
172
+ end
173
+
174
+ create_table :cms_section_nodes do |t|
175
+ t.string :node_type
176
+ t.integer :node_id
177
+ t.integer :position
178
+ t.string :ancestry
179
+ t.timestamps
180
+ end
181
+
182
+ create_content_table :cms_links do |t|
183
+ t.string :name
184
+ t.string :url
185
+ t.boolean :new_window, :default => false
186
+ t.timestamps
187
+ end
188
+ add_column :cms_links, :latest_version, :integer
189
+
190
+
191
+ create_table :cms_tags do |t|
192
+ t.string :name
193
+ t.timestamps
194
+ end
195
+
196
+ create_table :cms_taggings do |t|
197
+ t.integer :tag_id
198
+ t.integer :taggable_id
199
+ t.string :taggable_type
200
+ t.integer :taggable_version
201
+ t.timestamps
202
+ end
203
+
204
+ create_table :cms_email_messages do |t|
205
+ t.string :sender
206
+ t.text :recipients
207
+ t.text :subject
208
+ t.text :cc
209
+ t.text :bcc
210
+ t.text :body
211
+ t.string :content_type
212
+ t.datetime :delivered_at
213
+ t.timestamps
214
+ end
215
+
216
+ create_table :cms_tasks do |t|
217
+ t.integer :assigned_by_id
218
+ t.integer :assigned_to_id
219
+ t.integer :page_id
220
+ t.text :comment
221
+ t.date :due_date
222
+ t.datetime :completed_at
223
+ t.timestamps
224
+ end
225
+
226
+ create_table :cms_page_routes do |t|
227
+ t.string :name
228
+ t.string :pattern
229
+ t.belongs_to :page
230
+ t.text :code
231
+ t.timestamps
232
+ end
233
+ create_table :cms_page_route_options do |t|
234
+ t.belongs_to :page_route
235
+ t.string :type
236
+ t.string :name
237
+ t.string :value
238
+ t.timestamps
239
+ end
240
+
241
+ INDEXES.each do |index|
242
+ table_name, column = *index
243
+ add_index cms_(table_name), column
244
+ end
245
+ end
246
+
247
+ # Add some very commonly used indexes to improve the site performance as the # of pages/content grows (i.e. several thousand pages)
248
+ INDEXES = [
249
+ [:pages, :deleted],
250
+ [:pages, :path],
251
+ [:pages, :version],
252
+ [:page_versions, :original_record_id],
253
+ [:groups, :code],
254
+ [:groups, :group_type_id],
255
+ [:group_types, :cms_access],
256
+ [:group_sections, :section_id],
257
+ [:group_sections, :group_id],
258
+ [:users, :expires_at],
259
+ [:user_group_memberships, :group_id],
260
+ [:user_group_memberships, :user_id],
261
+ [:group_permissions, :group_id],
262
+ [:group_permissions, :permission_id],
263
+ [:group_permissions, [:group_id, :permission_id]],
264
+ [:section_nodes, :node_type],
265
+ [:section_nodes, :ancestry],
266
+ [:connectors, :page_id],
267
+ [:connectors, :page_version],
268
+ [:html_blocks, :deleted],
269
+ [:html_block_versions, :original_record_id],
270
+ [:html_block_versions, :version],
271
+ [:portlet_attributes, :portlet_id],
272
+ [:portlets, :name],
273
+ [:sections, :path],
274
+ [:redirects, :from_path],
275
+ [:connectors, :connectable_version],
276
+ [:connectors, :connectable_type],
277
+ [:content_types, :content_type_group_id],
278
+ [:content_types, :name],
279
+ [:file_block_versions, :original_record_id],
280
+ [:file_block_versions, :version],
281
+ [:file_blocks, :deleted],
282
+ [:file_blocks, :type],
283
+ [:attachment_versions, :original_record_id],
284
+ [:tasks, :page_id],
285
+ [:tasks, :completed_at],
286
+ [:tasks, :assigned_to_id],
287
+ ]
288
+ end