Преглед на файлове

Migration : ajout du produit "Don"

dev
Guillaume Bourgeois преди 5 години
родител
ревизия
9ef8eb2236
променени са 2 файла, в които са добавени 50 реда и са изтрити 0 реда
  1. +33
    -0
      console/migrations/m190205_160337_produit_don_distrib.php
  2. +17
    -0
      console/migrations/m190205_164612_ajout_produit_don_aux_distributions_existantes.php

+ 33
- 0
console/migrations/m190205_160337_produit_don_distrib.php Целия файл

@@ -0,0 +1,33 @@
<?php

use yii\db\Migration;

class m190205_160337_produit_don_distrib extends Migration {

public function up() {
$this->insert('product', [
'name' => 'Don',
'description' => 'Don à la plateforme distrib',
'recipe' => '',
'active' => 1,
'photo' => null,
'price' => 1,
'weight' => null,
'monday' => 1,
'tuesday' => 1,
'wednesday' => 1,
'thursday' => 1,
'friday' => 1,
'saturday' => 1,
'sunday' => 1,
'quantity_max' => null,
'id_producer' => 0,
'sale_mode' => 'unit',
'order' => 1000,
]) ;
}

public function down() {
$this->delete('product', 'name = \'Don\' AND id_producer = 0') ;
}
}

+ 17
- 0
console/migrations/m190205_164612_ajout_produit_don_aux_distributions_existantes.php Целия файл

@@ -0,0 +1,17 @@
<?php

use yii\db\Migration;

class m190205_164612_ajout_produit_don_aux_distributions_existantes extends Migration {

public function up() {
$distributionsArray = common\models\Distribution::find()->all() ;
foreach($distributionsArray as $distribution) {
$distribution->linkProductGift() ;
}
}

public function down() {
}
}

Loading…
Отказ
Запис