--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Handles the creation of table `{{%store_region_list}}`.
+ */
+class m250116_112712_create_store_region_list_table extends Migration
+{
+ const TABLE_NAME = 'erp24.store_region_list';
+ /**
+ * {@inheritdoc}
+ */
+ public function safeUp()
+ {
+ $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+
+ if (!isset($tableSchema)) {
+ $this->createTable(self::TABLE_NAME, [
+ 'id' => $this->primaryKey()->comment('Первичный ключ'),
+ 'name' => $this->string()->notNull()->comment('Регион'),
+ 'code' => $this->integer()->notNull()->comment('Код региона'),
+ 'okrug' => $this->string()->notNull()->comment('Округ'),
+ 'created_at' => $this->dateTime()
+ ->notNull()
+ ->defaultExpression('CURRENT_TIMESTAMP')
+ ->comment('Дата создания записи'),
+ ]);
+
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+ if (isset($tableSchema)) {
+ $this->dropTable(self::TABLE_NAME);
+ }
+ }
+}
--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Handles the creation of table `{{%store_city_list}}`.
+ */
+class m250116_112743_create_store_city_list_table extends Migration
+{
+ const TABLE_NAME = 'erp24.store_city_list';
+ /**
+ * {@inheritdoc}
+ */
+ public function safeUp()
+ {
+ $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+
+ if (!isset($tableSchema)) {
+ $this->createTable(self::TABLE_NAME, [
+ 'id' => $this->primaryKey()->comment('Первичный ключ'),
+ 'name' => $this->string()->notNull()->comment('Город'),
+ 'created_at' => $this->dateTime()
+ ->notNull()
+ ->defaultExpression('CURRENT_TIMESTAMP')
+ ->comment('Дата создания записи'),
+ ]);
+
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+ if (isset($tableSchema)) {
+ $this->dropTable(self::TABLE_NAME);
+ }
+ }
+}
--- /dev/null
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Handles the creation of table `{{%store_district_list}}`.
+ */
+class m250116_112755_create_store_district_list_table extends Migration
+{
+ const TABLE_NAME = 'erp24.store_district_list';
+ /**
+ * {@inheritdoc}
+ */
+ public function safeUp()
+ {
+ $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+
+ if (!isset($tableSchema)) {
+ $this->createTable(self::TABLE_NAME, [
+ 'id' => $this->primaryKey()->comment('Первичный ключ'),
+ 'name' => $this->string()->notNull()->comment('Район'),
+ 'city_id' => $this->integer()->notNull()->comment('ID города'),
+ 'created_at' => $this->dateTime()
+ ->notNull()
+ ->defaultExpression('CURRENT_TIMESTAMP')
+ ->comment('Дата создания записи'),
+ ]);
+ $this->addForeignKey(
+ 'fk-city_id',
+ self::TABLE_NAME,
+ 'city_id',
+ 'erp24.store_city_list',
+ 'id',
+ );
+
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function safeDown()
+ {
+ $tableSchema = $this->db->getTableSchema(self::TABLE_NAME);
+ if (isset($tableSchema)) {
+ $this->dropTable(self::TABLE_NAME);
+ }
+ }
+}