您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

31 行
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. }