From 68b618359e7474b70f24c9be8631e59ba1813cb6 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sun, 12 Jul 2015 07:32:50 +0200 Subject: [PATCH] Fixed migration on fresh setups. --- db/migrate/20150712000003_update_setting3.rb | 18 ++++++--- db/seeds.rb | 41 +++++++++++--------- 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/db/migrate/20150712000003_update_setting3.rb b/db/migrate/20150712000003_update_setting3.rb index 3aefc32d7..64d776676 100644 --- a/db/migrate/20150712000003_update_setting3.rb +++ b/db/migrate/20150712000003_update_setting3.rb @@ -15,13 +15,19 @@ class UpdateSetting3 < ActiveRecord::Migration setting.save } setting = Setting.find_by(name: 'product_name') - setting.preferences[:prio] = 1 - setting.save + if setting + setting.preferences[:prio] = 1 + setting.save + end setting = Setting.find_by(name: 'organization') - setting.preferences[:prio] = 2 - setting.save + if setting + setting.preferences[:prio] = 2 + setting.save + end setting = Setting.find_by(name: 'product_logo') - setting.preferences[:prio] = 3 - setting.save + if setting + setting.preferences[:prio] = 3 + setting.save + end end end diff --git a/db/seeds.rb b/db/seeds.rb index 0e0fadbbb..da79d6826 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -48,27 +48,10 @@ Setting.create_if_not_exists( }, ], }, + preferences: { render: true, session_check: true, prio: 1 }, state: 'Zammad', frontend: true ) -Setting.create_if_not_exists( - title: 'Organization', - name: 'organization', - area: 'System::Branding', - description: 'Will also be included in emails as an X-Header.', - options: { - form: [ - { - display: '', - null: false, - name: 'organization', - tag: 'input', - }, - ], - }, - state: '', - frontend: true -) Setting.create_if_not_exists( title: 'Logo', name: 'product_logo', @@ -84,9 +67,29 @@ Setting.create_if_not_exists( }, ], }, + preferences: { prio: 3 }, state: 'logo.svg', frontend: true ) +Setting.create_if_not_exists( + title: 'Organization', + name: 'organization', + area: 'System::Branding', + description: 'Will be shown in the app and is included in email headers.', + options: { + form: [ + { + display: '', + null: false, + name: 'organization', + tag: 'input', + }, + ], + }, + state: '', + preferences: { prio: 2 }, + frontend: true +) Setting.create_if_not_exists( title: 'SystemID', @@ -686,6 +689,7 @@ Setting.create_if_not_exists( }, ], }, + preferences: { render: true }, state: 'Ticket#', frontend: true ) @@ -1115,6 +1119,7 @@ Setting.create_if_not_exists( }, ], }, + preferences: { render: true }, state: false, frontend: true )