Closed philippfrenzel closed 7 years ago
What's about migrations to seed settings, any objections?
Migrations are probably the best idea.
Hi, currently solved it like:
use yii\db\Migration;
class m160605_131238_holiday_country_params extends Migration
{
public function up()
{
$settings = Yii::$app->settings;
//the number of holidays in Austria
$settings->set('newAT', '25', 'holiday', 'integer');
//the number of holidays in Germany
$settings->set('newDE', '28', 'holiday', 'integer');
//the number of holidays in Swiss
$settings->set('newCH', '25', 'holiday', 'integer');
//the mail adress of the administrator
$settings->set('hrDepartment', 'hr@frenzel.net', 'holiday', 'string');
//when does the fiscal year start
$settings->set('fiscalYear', '-05-01', 'holiday', 'string');
}
public function down()
{
echo "m160605_131238_holiday_country_params cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
This should be added to the docs, IMHO.
Can be closed with the above commit.
Hi can you write a short doku about how to seed settings?!
Thanks Philipp