From 2fa18b816f40994a7893038dacb67bf245122940 Mon Sep 17 00:00:00 2001 From: marina Date: Thu, 13 Jun 2024 10:50:53 +0300 Subject: [PATCH] =?utf8?q?ERP-5=20=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?utf8?q?=D1=82=D0=B0=D1=82=D1=8C=20=D1=84=D0=B0=D0=BA=D1=82=D0=B8=D1=87?= =?utf8?q?=D0=B5=D1=81=D0=BA=D0=B8=D0=B9=20=D0=BF=D0=BB=D0=B0=D0=BD=20?= =?utf8?q?=D0=BF=D0=BE=20=D1=81=D0=BE=D1=82=D1=80=D1=83=D0=B4=D0=BD=D0=B8?= =?utf8?q?=D0=BA=D0=B0=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- ...0603_082541_create_new_fact_plan_table.php | 65 ++++++++++--------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/erp24/migrations/m240603_082541_create_new_fact_plan_table.php b/erp24/migrations/m240603_082541_create_new_fact_plan_table.php index e9cabca4..2ab233db 100644 --- a/erp24/migrations/m240603_082541_create_new_fact_plan_table.php +++ b/erp24/migrations/m240603_082541_create_new_fact_plan_table.php @@ -1,6 +1,7 @@ createTable('{{%erp24.timetable_fact}}', [ - 'id' => $this->primaryKey(), - 'admin_id' => $this->integer()->comment('ID сотрудника'), - 'store_id' => $this->integer()->comment('ID магазина'), - 'admin_group_id' => $this->integer()->comment('ID должности'), - 'd_id' => $this->integer()->comment('в какой должности работал на смене'), - 'date_shift' => $this->date()->comment('дата смены'), - 'date_start' => $this->date()->comment('дата время открытия смены'), - 'date_end' => $this->date()->comment('дата время закрытия смены'), - 'is_opening' => $this->boolean()->comment('на открытие смены'), - 'is_close' => $this->boolean()->comment('на закрытие смены'), - 'tabel' => $this->integer()->comment('табель'), - 'plan_id' => $this->integer()->comment('ID табеля если смена поставлена'), - 'shift_id' => $this->integer()->comment('тип смены'), - 'admin_id_add' => $this->integer()->comment('ID поставившего смену'), - 'time_start' => $this->time()->comment('время начала работы по графику'), - 'time_end' => $this->time()->comment('время окончания работы по графику'), - 'work_time' => $this->float()->comment('рабочее время'), - 'price_hour' => $this->float()->comment('часовая ставка'), - 'salary_shift' => $this->integer()->comment('оплата за смену'), - 'slot_type_id' => $this->integer()->comment('тип занятности'), - 'comment' => $this->text()->comment('комментарий'), - 'date_add' => $this->timestamp()->comment('дата постановки смены'), - 'status' => $this->integer()->comment('статус смены'), - ]); + if ($this->db->getTableSchema(TimetableFact::tableName()) !== null) { + $this->createTable('{{%erp24.timetable_fact}}', [ + 'id' => $this->primaryKey(), + 'admin_id' => $this->integer()->comment('ID сотрудника'), + 'store_id' => $this->integer()->comment('ID магазина'), + 'admin_group_id' => $this->integer()->comment('ID должности'), + 'd_id' => $this->integer()->comment('в какой должности работал на смене'), + 'date_shift' => $this->date()->comment('дата смены'), + 'date_start' => $this->date()->comment('дата время открытия смены'), + 'date_end' => $this->date()->comment('дата время закрытия смены'), + 'is_opening' => $this->boolean()->comment('на открытие смены'), + 'is_close' => $this->boolean()->comment('на закрытие смены'), + 'tabel' => $this->integer()->comment('табель'), + 'plan_id' => $this->integer()->comment('ID табеля если смена поставлена'), + 'shift_id' => $this->integer()->comment('тип смены'), + 'admin_id_add' => $this->integer()->comment('ID поставившего смену'), + 'time_start' => $this->time()->comment('время начала работы по графику'), + 'time_end' => $this->time()->comment('время окончания работы по графику'), + 'work_time' => $this->float()->comment('рабочее время'), + 'price_hour' => $this->float()->comment('часовая ставка'), + 'salary_shift' => $this->integer()->comment('оплата за смену'), + 'slot_type_id' => $this->integer()->comment('тип занятности'), + 'comment' => $this->text()->comment('комментарий'), + 'date_add' => $this->timestamp()->comment('дата постановки смены'), + 'status' => $this->integer()->comment('статус смены'), + ]); - $this->addForeignKey('fk_timetable_fact_to_admin', 'timetable_fact', 'admin_id', 'admin', 'id'); - $this->addForeignKey('fk_timetable_fact_to_store', 'timetable_fact', 'store_id', 'store', 'id'); - $this->addForeignKey('fk_timetable_fact_to_admin_group', 'timetable_fact', 'admin_group_id', 'admin_group', 'id'); - $this->addForeignKey('fk_timetable_fact_to_admin_group_as_d', 'timetable_fact', 'd_id', 'admin_group', 'id'); - $this->addForeignKey('fk_timetable_fact_to_plan', 'timetable_fact', 'plan_id', 'timetable', 'id'); - $this->addForeignKey('fk_timetable_fact_to_admin_as_admin_id_add', 'timetable_fact', 'admin_id_add', 'admin', 'id'); + $this->addForeignKey('fk_timetable_fact_to_admin', 'timetable_fact', 'admin_id', 'admin', 'id'); + $this->addForeignKey('fk_timetable_fact_to_store', 'timetable_fact', 'store_id', 'store', 'id'); + $this->addForeignKey('fk_timetable_fact_to_admin_group', 'timetable_fact', 'admin_group_id', 'admin_group', 'id'); + $this->addForeignKey('fk_timetable_fact_to_admin_group_as_d', 'timetable_fact', 'd_id', 'admin_group', 'id'); + $this->addForeignKey('fk_timetable_fact_to_plan', 'timetable_fact', 'plan_id', 'timetable', 'id'); + $this->addForeignKey('fk_timetable_fact_to_admin_as_admin_id_add', 'timetable_fact', 'admin_id_add', 'admin', 'id'); + } } /** -- 2.39.5