forked from AlchemyCMS/alchemy_cms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
db/migrate/20200519073500_remove_visible_from_alchemy_pages.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
class RemoveVisibleFromAlchemyPages < ActiveRecord::Migration[5.2] | ||
class LocalPage < ActiveRecord::Base | ||
self.table_name = "alchemy_pages" | ||
|
||
scope :invisible, -> { where(visible: [false, nil]) } | ||
scope :contentpages, -> { where(layoutpage: [false, nil]) } | ||
end | ||
|
||
def up | ||
if LocalPage.invisible.contentpages.where.not(parent_id: nil).any? | ||
abort "You have invisible pages in your database! " \ | ||
"Please re-structure your page tree before running this migration. " \ | ||
"You might also downgrade to Alchemy 4.6 and " \ | ||
"run the `alchemy:upgrade:4.6:restructure_page_tree` rake task." | ||
end | ||
|
||
remove_column :alchemy_pages, :visible | ||
end | ||
|
||
def down | ||
add_column :alchemy_pages, :visible, :boolean, default: false | ||
end | ||
end |
1 change: 1 addition & 0 deletions
1
spec/dummy/db/migrate/20200519073500_remove_visible_from_alchemy_pages.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../db/migrate/20200519073500_remove_visible_from_alchemy_pages.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters