Add date type and context columns to meal

This commit is contained in:
Chris Smith
2025-02-23 12:41:33 +01:00
parent d7341d02f5
commit 70e88433ce
3 changed files with 38 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
<?php
use yii\db\Migration;
class m250223_111753_add_type_date_context_columns_to_meal extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('{{%meal}}', 'type', $this->string()->null()); // nullable because existing user data
$this->addColumn('{{%meal}}', 'date', $this->date()->null()); // nullable because existing user data
$this->addColumn('{{%meal}}', 'context', $this->string(100)->null());
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropColumn('{{%meal}}', 'type');
$this->dropColumn('{{%meal}}', 'date');
$this->dropColumn('{{%meal}}', 'context');
}
}