Hello, how I can add settings to database from .zpm?
I have code in db/seed (.zpm package), but it don’t create & update records in database.
Setting.create_or_update(
title: __('Ticket Number Format'),
name: 'ticket_number',
area: 'Ticket::Number',
description: __("Selects the ticket number generator module.
* **Increment** increments the ticket number, the SystemID and the counter are used with SystemID.Counter format (e.g. 1010138, 1010139).
* With **Date** the ticket numbers will be generated by the current date, the SystemID and the counter. The format looks like Year.Month.Day.SystemID.counter (e.g. 201206231010138, 201206231010139)."),
options: {
form: [
{
display: '',
null: true,
name: 'ticket_number',
tag: 'select',
translate: true,
options: {
'Ticket::Number::Increment' => __('Increment (SystemID.Counter)'),
'Ticket::Number::Date' => __('Date (Year.Month.Day.SystemID.Counter)'),
'Ticket::Number::Year' => __('Date (Year.Month.Day.SystemID.Counter)'),
},
},
],
},
state: 'Ticket::Number::Increment',
preferences: {
settings_included: %w[ticket_number_increment ticket_number_date ticket_number_year],
controller: 'SettingsAreaTicketNumber',
permission: ['admin.ticket'],
},
frontend: false
)
Setting.create_if_not_exists(
title: __('Ticket Number Year'),
name: 'ticket_number_year',
area: 'Ticket::Number',
description: '-',
options: {
form: [
{
display: __('Checksum'),
null: true,
name: 'checksum',
tag: 'boolean',
options: {
true => 'yes',
false => 'no',
},
},
{
display: __('Min. size of number'),
null: true,
name: 'min_size',
tag: 'select',
options: {
1 => ' 1',
2 => ' 2',
3 => ' 3',
4 => ' 4',
5 => ' 5',
6 => ' 6',
7 => ' 7',
8 => ' 8',
9 => ' 9',
10 => '10',
11 => '11',
12 => '12',
13 => '13',
14 => '14',
15 => '15',
16 => '16',
17 => '17',
18 => '18',
19 => '19',
20 => '20',
},
},
],
},
state: {
checksum: false,
min_size: 5,
},
preferences: {
permission: ['admin.ticket'],
hidden: true,
},
frontend: false
)
What is wrong?