Improved cleaning up migrations later and applied ux_flow_next_up = 'next_task' for default "Close & tag as spam" macro.

This commit is contained in:
Martin Edenhofer 2018-06-22 13:17:12 +02:00
parent 76f3a2876b
commit 24a30ad26c
3 changed files with 14 additions and 0 deletions

View file

@ -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

View file

@ -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

View file

@ -13,6 +13,7 @@ Macro.create_if_not_exists(
value: '',
},
},
ux_flow_next_up: 'next_task',
note: 'example macro',
active: true,
)