Migrate.php 801 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace plugins\donation\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Handles the creation for table `{{%donation}}`.
  6. */
  7. class Migrate extends Migration
  8. {
  9. /**
  10. * @inheritdoc
  11. */
  12. public function up()
  13. {
  14. $this->createTable('{{%donation}}', [
  15. 'id' => $this->primaryKey(),
  16. 'name' => $this->string(50)->notNull(),
  17. 'money' => $this->decimal()->notNull(),
  18. 'remark' => $this->string(255)->comment('留言'),
  19. 'source' => $this->string(255)->comment('来源'),
  20. 'created_at' => $this->integer(10)->notNull(),
  21. 'updated_at' => $this->integer(10)->notNull()
  22. ]);
  23. }
  24. /**
  25. * @inheritdoc
  26. */
  27. public function down()
  28. {
  29. $this->dropTable('{{%donation}}');
  30. }
  31. }