--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m240820_150742_create_table_motivation_buh
+ */
+class m240820_150742_create_table_motivation_buh extends Migration
+{
+ const TABLE_NAME = "erp24.motivation_buh";
+ const TABLE_NAME2 = "erp24.motivation_buh_value";
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeUp()
+ {
+ $this->createTable(self::TABLE_NAME, [
+ 'id' => $this->primaryKey(),
+ 'inn' => $this->integer()->notNull()->comment('ИНН фирмы источника данных'),
+ 'year' => $this->integer()->notNull()->comment('Год'),
+ 'month' => $this->integer()->notNull()->comment('Месяц'),
+ 'updated_at' => $this->datetime()->notNull()->comment('Дата изменения записи'),
+ 'created_at' => $this->datetime()->notNull()->comment('Дата создания записи'),
+ ]);
+
+ $this->createTable(self::TABLE_NAME2, [
+ 'id' => $this->primaryKey(),
+ 'motivation_buh_id' => $this->integer()->notNull()->comment('id motivation buh'),
+ 'store_id' => $this->integer()->notNull()->comment('ID магазина'),
+ 'motivation_group_id' => $this->integer()->notNull()->comment('group id motivation'),
+ 'value_id' => $this->integer()->notNull()->comment('value id'),
+ 'value_type' => $this->string(10)->notNull()->comment('тип значения'),
+ 'value_int' => $this->integer()->null()->comment('value int'),
+ 'value_float' => $this->float()->null()->comment('value float'),
+ 'value_string' => $this->string()->null()->comment('value string'),
+ ]);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ $this->dropTable(self::TABLE_NAME2);
+ $this->dropTable(self::TABLE_NAME);
+ }
+}
--- /dev/null
+<?php
+
+namespace app\records;
+
+
+/**
+ * This is the model class for table "motivation_buh".
+ *
+ * @property int $id
+ * @property int $inn ИНН фирмы источника данных
+ * @property int $year Год
+ * @property int $month Месяц
+ * @property string $updated_at Дата изменения записи
+ * @property string $created_at Дата создания записи
+ */
+class MotivationBuh extends \yii\db\ActiveRecord
+{
+ /**
+ * {@inheritdoc}
+ */
+ public static function tableName()
+ {
+ return 'motivation_buh';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function rules()
+ {
+ return [
+ [['inn', 'year', 'month'], 'required'],
+ [['inn', 'year', 'month'], 'default', 'value' => null],
+ [['inn', 'year', 'month'], 'integer'],
+ [['updated_at', 'created_at'], 'safe'],
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'id' => 'ID',
+ 'inn' => 'Inn',
+ 'year' => 'Year',
+ 'month' => 'Month',
+ 'updated_at' => 'Updated At',
+ 'created_at' => 'Created At',
+ ];
+ }
+}
\ No newline at end of file
--- /dev/null
+<?php
+
+namespace app\records;
+
+use yii\db\ActiveRecord;
+
+/**
+ * This is the model class for table "motivation_buh_value".
+ *
+ * @property int $id
+ * @property int $motivation_buh_id id motivation buh
+ * @property int $store_id ID магазина
+ * @property int $motivation_group_id group id motivation
+ * @property int $value_id value id
+ * @property string $value_type тип значения
+ * @property int|null $value_int value int
+ * @property float|null $value_float value float
+ * @property string|null $value_string value string
+ */
+class MotivationBuhValue extends ActiveRecord
+{
+ /**
+ * {@inheritdoc}
+ */
+ public static function tableName()
+ {
+ return 'motivation_buh_value';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function rules()
+ {
+ return [
+ [['motivation_buh_id', 'store_id', 'motivation_group_id', 'value_id', 'value_type'], 'required'],
+ [['motivation_buh_id', 'store_id', 'motivation_group_id', 'value_id', 'value_int'], 'default', 'value' => null],
+ [['motivation_buh_id', 'store_id', 'motivation_group_id', 'value_id', 'value_int'], 'integer'],
+ [['value_float'], 'number'],
+ [['value_type'], 'string', 'max' => 10],
+ [['value_string'], 'string', 'max' => 255],
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'id' => 'ID',
+ 'motivation_buh_id' => 'Motivation Buh ID',
+ 'store_id' => 'Store ID',
+ 'motivation_group_id' => 'Motivation Group ID',
+ 'value_id' => 'Value ID',
+ 'value_type' => 'Value Type',
+ 'value_int' => 'Value Int',
+ 'value_float' => 'Value Float',
+ 'value_string' => 'Value String',
+ ];
+ }
+}
\ No newline at end of file