Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.0 Upgrader fixes #1874

Merged
merged 3 commits into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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