diff --git a/db/migrate/20120101000010_create_ticket.rb b/db/migrate/20120101000010_create_ticket.rb index 3d4a0c420..9c16bf3d7 100644 --- a/db/migrate/20120101000010_create_ticket.rb +++ b/db/migrate/20120101000010_create_ticket.rb @@ -452,6 +452,7 @@ class CreateTicket < ActiveRecord::Migration[4.2] t.string :name, limit: 250, null: true t.text :perform, limit: 500.kilobytes + 1, null: false t.boolean :active, null: false, default: true + t.string :ux_flow_next_up, null: false, default: 'none' t.string :note, limit: 250, null: true t.integer :updated_by_id, null: false t.integer :created_by_id, null: false diff --git a/db/migrate/20180611070839_add_ux_flow_next_up_to_macros.rb b/db/migrate/20180611070839_add_ux_flow_next_up_to_macros.rb index 9661930c3..e956fda35 100644 --- a/db/migrate/20180611070839_add_ux_flow_next_up_to_macros.rb +++ b/db/migrate/20180611070839_add_ux_flow_next_up_to_macros.rb @@ -1,5 +1,17 @@ class AddUxFlowNextUpToMacros < ActiveRecord::Migration[5.1] def change + + # return if it's a new setup + return if !Setting.find_by(name: 'system_init_done') + add_column :macros, :ux_flow_next_up, :string, default: 'none', null: false + + Macro.connection.schema_cache.clear! + Macro.reset_column_information + + macro = Macro.find_by(name: 'Close & Tag as Spam') + return if !macro + macro.ux_flow_next_up = 'next_task' + macro.save! end end diff --git a/db/seeds/macros.rb b/db/seeds/macros.rb index 439bd31ea..38909b5d3 100644 --- a/db/seeds/macros.rb +++ b/db/seeds/macros.rb @@ -13,6 +13,7 @@ Macro.create_if_not_exists( value: '', }, }, + ux_flow_next_up: 'next_task', note: 'example macro', active: true, )