From: fomichev Date: Wed, 29 Jan 2025 15:02:46 +0000 (+0300) Subject: Создана миграция для таблицы X-Git-Tag: 1.7~22^2~2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=f75751bdfca9bdfa5d24bd490a9925819fae8c3c;p=erp24_rep%2Fyii-erp24%2F.git Создана миграция для таблицы --- diff --git a/erp24/migrations/m250129_144216_create_table_products_1c_nomenclature.php b/erp24/migrations/m250129_144216_create_table_products_1c_nomenclature.php new file mode 100644 index 00000000..39677ba6 --- /dev/null +++ b/erp24/migrations/m250129_144216_create_table_products_1c_nomenclature.php @@ -0,0 +1,67 @@ +db->getTableSchema(self::TABLE_NAME); + + if (!isset($tableSchema)) { + $this->createTable(self::TABLE_NAME, [ + 'id' => $this->string()->notNull()->comment('GUID - уникальный номер номенклатуры в 1С'), + 'location' => $this->string() + ->notNull() + ->comment('расположение номенклатуры в системе 1С, т.е. путь до папки где храниться номенклатура'), + 'name' => $this->string() + ->notNull() + ->comment('имя номенклатуры'), + 'type_num' => $this->string() + ->notNull() + ->comment('Название вида номенклатуры из логического условия, без квадратных скобок.'), + 'category' => $this->string()->notNull()->comment('Категория'), + 'subcategory' => $this->string()->notNull()->comment('Подкатегория'), + 'species' => $this->string()->comment('Вид'), + 'sort' => $this->string()->comment('Сорт'), + 'size' => $this->integer()->comment('Размер'), + 'measure' => $this->string()->comment('Единица измерения'), + 'color' => $this->string()->comment('Цвет'), + 'PRIMARY KEY(id)', + ]); + } + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $tableSchema = $this->db->getTableSchema(self::TABLE_NAME); + if (isset($tableSchema)) { + $this->dropTable(self::TABLE_NAME); + } + } + + /* + // Use up()/down() to run migration code without a transaction. + public function up() + { + + } + + public function down() + { + echo "m250129_144216_create_table_products_1c_nomenclature cannot be reverted.\n"; + + return false; + } + */ +}