diff --git a/db/migrate/20200511113603_add_menu_type_to_alchemy_nodes.rb b/db/migrate/20200511113603_add_menu_type_to_alchemy_nodes.rb index f300d38fd2..258f31cae1 100644 --- a/db/migrate/20200511113603_add_menu_type_to_alchemy_nodes.rb +++ b/db/migrate/20200511113603_add_menu_type_to_alchemy_nodes.rb @@ -11,13 +11,17 @@ def self.root_for(node) end end - def change + def up add_column :alchemy_nodes, :menu_type, :string LocalNode.all.each do |node| root = LocalNode.root_for(node) menu_type = root.name.parameterize.underscore node.update(menu_type: menu_type) end - change_column :alchemy_nodes, :menu_type, :string, null: false + change_column_null :alchemy_nodes, :menu_type, false + end + + def down + remove_column :alchemy_nodes, :menu_type end end diff --git a/lib/tasks/alchemy/upgrade.rake b/lib/tasks/alchemy/upgrade.rake index 17256f0db1..45c134dcc8 100644 --- a/lib/tasks/alchemy/upgrade.rake +++ b/lib/tasks/alchemy/upgrade.rake @@ -6,6 +6,7 @@ namespace :alchemy do desc "Upgrades your app to AlchemyCMS v#{Alchemy::VERSION}." task upgrade: [ "alchemy:upgrade:prepare", + "alchemy:upgrade:5.0:run", ] do Alchemy::Upgrader.display_todos end @@ -19,12 +20,8 @@ namespace :alchemy do desc "Alchemy Upgrader: Prepares the database." task database: [ - "alchemy:upgrade:5.0:install_gutentag_migrations", - "alchemy:upgrade:5.0:remove_layout_roots", - "alchemy:upgrade:5.0:remove_root_page", "alchemy:install:migrations", "db:migrate", - "alchemy:db:seed", ] desc "Alchemy Upgrader: Copy configuration file." @@ -35,11 +32,18 @@ namespace :alchemy do desc "Upgrade Alchemy to v5.0" task "5.0" => [ "alchemy:upgrade:prepare", + "alchemy:upgrade:5.0:run", ] do Alchemy::Upgrader.display_todos end namespace "5.0" do + task "run" => [ + "alchemy:upgrade:5.0:install_gutentag_migrations", + "alchemy:upgrade:5.0:remove_layout_roots", + "alchemy:upgrade:5.0:remove_root_page", + ] + desc "Install Gutentag migrations" task install_gutentag_migrations: [:environment] do Alchemy::Upgrader::FivePointZero.install_gutentag_migrations