Skip to content

Commit

Permalink
Merge pull request AlchemyCMS#1874 from tvdeyen/upgrader-fixes
Browse files Browse the repository at this point in the history
5.0 Upgrader fixes
  • Loading branch information
tvdeyen authored Jun 5, 2020
2 parents b60c75f + daa78e3 commit 9a19906
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 6 additions & 2 deletions db/migrate/20200511113603_add_menu_type_to_alchemy_nodes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 8 additions & 4 deletions lib/tasks/alchemy/upgrade.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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."
Expand All @@ -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
Expand Down

0 comments on commit 9a19906

Please sign in to comment.