|
1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
-
- use yii\db\Migration;
- use yii\db\Schema;
-
- /**
- * Class m240603_131331_create_table_shared_point_sale
- */
- class m240603_131331_create_table_shared_point_sale extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $this->createTable('shared_point_sale', [
- 'id' => 'pk',
- 'id_point_sale' => Schema::TYPE_INTEGER,
- 'id_producer_with_sharing' => Schema::TYPE_INTEGER,
- 'id_point_sale_with_sharing' => Schema::TYPE_INTEGER,
- 'status' => Schema::TYPE_INTEGER,
- ]);
- $this->addForeignKey('fk_id_point_sale', 'shared_point_sale', 'id_point_sale', 'point_sale', 'id');
- $this->addForeignKey('fk_id_producer', 'shared_point_sale', 'id_producer_with_sharing', 'producer', 'id');
- $this->addForeignKey('fk_id_point_sale_with_sharing', 'shared_point_sale', 'id_point_sale_with_sharing', 'point_sale', 'id');
- }
-
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- $this->dropTable('shared_point_sale');
- $this->dropForeignKey('fk_id_point_sale', 'shared_point_sale');
- $this->dropForeignKey('fk_id_producer', 'shared_point_sale');
- $this->dropForeignKey('fk_id_point_sale_with_sharing', 'shared_point_sale');
- }
- }
|