--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m240826_113149_create_table_self_cost
+ */
+class m240826_113149_create_table_self_cost extends Migration
+{
+ const TABLE_NAME = "erp24.self_cost_product";
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeUp()
+ {
+ $this->createTable(self::TABLE_NAME, [
+ 'id' => $this->primaryKey(),
+ 'date' => $this->date()->notNull()->comment('Дата'),
+ 'store_id' => $this->integer()->notNull()->comment('store id'),
+ 'product_guid' => $this->string()->notNull()->comment('product guid'),
+ 'price' => $this->float()->notNull()->comment('price'),
+ 'updated_at' => $this->datetime()->null()->comment('Дата внесения записи'),
+ ]);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ $this->dropTable(self::TABLE_NAME);
+ }
+}
--- /dev/null
+<?php
+
+namespace app\records;
+
+
+/**
+ * This is the model class for table "self_cost_product".
+ *
+ * @property int $id
+ * @property string $date Дата
+ * @property int $store_id store id
+ * @property string $product_guid product guid
+ * @property float $price price
+ * @property string|null $updated_at Дата внесения записи
+ */
+class SelfCostProduct extends \yii\db\ActiveRecord
+{
+ /**
+ * {@inheritdoc}
+ */
+ public static function tableName()
+ {
+ return 'self_cost_product';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function rules()
+ {
+ return [
+ [['date', 'store_id', 'product_guid', 'price'], 'required'],
+ [['date', 'updated_at'], 'safe'],
+ [['store_id'], 'default', 'value' => null],
+ [['store_id'], 'integer'],
+ [['price'], 'number'],
+ [['product_guid'], 'string', 'max' => 255],
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'id' => 'ID',
+ 'date' => 'Date',
+ 'store_id' => 'Store ID',
+ 'product_guid' => 'Product Guid',
+ 'price' => 'Price',
+ 'updated_at' => 'Updated At',
+ ];
+ }
+}