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.

m160216_155856_cdn_2_0.php 1.2KB

8 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. use yii\db\Schema;
  3. use yii\db\Migration;
  4. class m160216_155856_cdn_2_0 extends Migration
  5. {
  6. public function up()
  7. {
  8. // champs adresse + credit user
  9. $this->addColumn('user', 'adresse', Schema::TYPE_TEXT) ;
  10. $this->addColumn('user', 'credit', Schema::TYPE_FLOAT) ;
  11. // champs commentaire commande
  12. $this->addColumn('commande', 'commentaire', Schema::TYPE_TEXT) ;
  13. // table credit_historique
  14. $this->createTable('credit_historique', [
  15. 'id' => 'pk',
  16. 'id_user' => Schema::TYPE_INTEGER . ' NOT NULL',
  17. 'id_commande' => Schema::TYPE_INTEGER,
  18. 'date' => Schema::TYPE_DATETIME,
  19. 'montant' => Schema::TYPE_FLOAT,
  20. 'type' => Schema::TYPE_STRING.' NOT NULL'
  21. ]);
  22. }
  23. public function down()
  24. {
  25. $this->dropColumn('user', 'adresse') ;
  26. $this->dropColumn('user', 'credit') ;
  27. $this->dropColumn('commande', 'commentaire') ;
  28. $this->dropTable('credit_historique');
  29. }
  30. /*
  31. // Use safeUp/safeDown to run migration code within a transaction
  32. public function safeUp()
  33. {
  34. }
  35. public function safeDown()
  36. {
  37. }
  38. */
  39. }