Skip to content

Commit be46393

Browse files
committed
[browsermedia#668] Compress migrations
* Compress migrations into a single 400 migrations * Seeds puts home page ordered before system section by default now
1 parent 56ee15b commit be46393

File tree

6 files changed

+35
-66
lines changed

6 files changed

+35
-66
lines changed

db/browsercms.seeds.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@
3030
3131
create_site(:default, :name => "Default", :domain => "example.com")
3232
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 }
3633
3734
create_page(:home, :name => "Home", :path => "/", :section => sections(:root), :template_file_name => "default.html.erb", :cacheable => true)
35+
36+
create_section(:system, :name => "system", :parent => sections(:root), :path => "/system", :hidden => true)
3837
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)
3938
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)
4039
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)
@@ -52,6 +51,8 @@
5251
pages(:server_error).publish!
5352
pages(:home).publish!
5453
54+
Cms::Group.all.each { |g| g.sections = Cms::Section.all }
55+
5556
unless Cms::DataLoader.silent_mode
5657
puts "*************************************************"
5758
puts "* YOUR CMS username/password is: cmsadmin/#{pwd}"

db/migrate/20130327184912_browsercms400.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,40 @@ def up
5555
t.timestamps
5656
end
5757

58+
add_devise_users
59+
remove_reset_password_portlet
60+
add_external_users
5861
end
5962

63+
64+
6065
private
6166

67+
def add_external_users
68+
change_table :cms_users do |t|
69+
t.column :type, :string, default: 'Cms::User'
70+
t.column :source, :string
71+
t.text :external_data
72+
end
73+
end
74+
75+
def remove_reset_password_portlet
76+
Cms::Portlet.connection.execute("UPDATE cms_portlets SET type = 'DeprecatedPlaceholder' WHERE type = 'ResetPasswordPortlet'")
77+
end
78+
79+
def add_devise_users
80+
change_table(:cms_users) do |t|
81+
t.string :encrypted_password, :null => false, :default => ""
82+
t.rename :reset_token, :reset_password_token
83+
t.datetime :reset_password_sent_at
84+
t.rename :remember_token_expires_at, :remember_created_at
85+
t.remove :remember_token
86+
t.remove :crypted_password
87+
end
88+
89+
add_index :cms_users, :email, :unique => true
90+
add_index :cms_users, :reset_password_token, :unique => true
91+
end
6292
# In 4.x, all core tables MUST start with cms_. See https://github.com/browsermedia/browsercms/issues/639
6393
def apply_cms_namespace_to_all_core_tables
6494
unversioned_tables.each do |table_name|

db/migrate/20131206214021_devise_create_users.rb

Lines changed: 0 additions & 47 deletions
This file was deleted.

db/migrate/20131211223908_kill_reset_password.rb

Lines changed: 0 additions & 5 deletions
This file was deleted.

db/migrate/20131218222005_create_cms_external_users.rb

Lines changed: 0 additions & 10 deletions
This file was deleted.

test/dummy/db/schema.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
# It's strongly recommended that you check this file into your version control system.
1313

14-
ActiveRecord::Schema.define(version: 20131218222005) do
14+
ActiveRecord::Schema.define(version: 20130924162315) do
1515

1616
create_table "catalog_versions", force: true do |t|
1717
t.string "name"

0 commit comments

Comments
 (0)