You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 line
1.4KB

  1. <?php
  2. use yii\db\Migration;
  3. use yii\db\Schema;
  4. class m161125_075714_commandes_automatiques extends Migration
  5. {
  6. public function up()
  7. {
  8. $this->createTable('commande_auto', [
  9. 'id' => 'pk',
  10. 'id_user' => Schema::TYPE_INTEGER ,
  11. 'id_etablissement' => Schema::TYPE_INTEGER. ' NOT NULL',
  12. 'date_debut' => Schema::TYPE_DATE,
  13. 'date_fin' => Schema::TYPE_DATE,
  14. 'lundi' => Schema::TYPE_BOOLEAN,
  15. 'mardi' => Schema::TYPE_BOOLEAN,
  16. 'mercredi' => Schema::TYPE_BOOLEAN,
  17. 'jeudi' => Schema::TYPE_BOOLEAN,
  18. 'vendredi' => Schema::TYPE_BOOLEAN,
  19. 'samedi' => Schema::TYPE_BOOLEAN,
  20. 'dimanche' => Schema::TYPE_BOOLEAN,
  21. 'periodicite_semaine' => Schema::TYPE_INTEGER,
  22. ]);
  23. $this->createTable('commande_auto_produit', [
  24. 'id' => 'pk',
  25. 'id_commande_auto' => Schema::TYPE_INTEGER . ' NOT NULL',
  26. 'id_produit' => Schema::TYPE_INTEGER . ' NOT NULL',
  27. 'quantite' => Schema::TYPE_FLOAT,
  28. ]);
  29. }
  30. public function down()
  31. {
  32. $this->dropTable('commande_auto') ;
  33. $this->dropTable('commande_auto_produit') ;
  34. }
  35. /*
  36. // Use safeUp/safeDown to run migration code within a transaction
  37. public function safeUp()
  38. {
  39. }
  40. public function safeDown()
  41. {
  42. }
  43. */
  44. }