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.

31 lines
940B

  1. <?php
  2. use yii\db\Migration;
  3. use yii\db\Schema;
  4. class m201207_160043_specific_prices extends Migration
  5. {
  6. public function safeUp()
  7. {
  8. $this->createTable('product_price', [
  9. 'id' => 'pk',
  10. 'id_product' => Schema::TYPE_INTEGER . ' NOT NULL',
  11. 'id_user' => Schema::TYPE_INTEGER,
  12. 'id_point_sale' => Schema::TYPE_INTEGER,
  13. 'price' => Schema::TYPE_FLOAT,
  14. ]);
  15. $this->addColumn('user_producer', 'product_price_percent', Schema::TYPE_INTEGER) ;
  16. $this->addColumn('point_sale', 'product_price_percent', Schema::TYPE_INTEGER) ;
  17. }
  18. public function safeDown()
  19. {
  20. $this->dropTable('product_price') ;
  21. $this->dropColumn('user_producer', 'product_price_percent') ;
  22. $this->dropColumn('point_sale', 'product_price_percent') ;
  23. return false;
  24. }
  25. }