Просмотр файла app/database/migrations/20161216120359_create_downs_table.php

Размер файла: 1.8Kb
  1. <?php
  2.  
  3. use Phinx\Migration\AbstractMigration;
  4. use Phinx\Db\Adapter\MysqlAdapter;
  5.  
  6. class CreateDownsTable extends AbstractMigration
  7. {
  8. /**
  9. * Change Method.
  10. */
  11. public function change()
  12. {
  13. $table = $this->table('downs', ['collation' => 'utf8mb4_unicode_ci']);
  14. $table->addColumn('category_id', 'integer', ['limit' => MysqlAdapter::INT_SMALL, 'signed' => false, 'default' => 0])
  15. ->addColumn('title', 'string', ['limit' => 100])
  16. ->addColumn('text', 'text', ['null' => true])
  17. ->addColumn('link', 'string', ['limit' => 50])
  18. ->addColumn('user', 'string', ['limit' => 20])
  19. ->addColumn('author', 'string', ['limit' => 50])
  20. ->addColumn('site', 'string', ['limit' => 50, 'null' => true])
  21. ->addColumn('screen', 'string', ['limit' => 50, 'null' => true])
  22. ->addColumn('time', 'integer')
  23. ->addColumn('comments', 'integer', ['limit' => MysqlAdapter::INT_MEDIUM, 'signed' => false, 'default' => 0])
  24. ->addColumn('rating', 'integer', ['limit' => MysqlAdapter::INT_MEDIUM, 'signed' => false, 'default' => 0])
  25. ->addColumn('rated', 'integer', ['limit' => MysqlAdapter::INT_MEDIUM, 'signed' => false, 'default' => 0])
  26. ->addColumn('loads', 'integer', ['limit' => MysqlAdapter::INT_MEDIUM, 'signed' => false, 'default' => 0])
  27. ->addColumn('last_load', 'integer', ['default' => 0])
  28. ->addColumn('app', 'boolean', ['default' => 0])
  29. ->addColumn('notice', 'text', ['null' => true])
  30. ->addColumn('active', 'boolean', ['default' => 0])
  31. ->addIndex('category_id')
  32. ->addIndex('time')
  33. ->addIndex('text', ['type' => 'fulltext'])
  34. ->addIndex('title', ['type' => 'fulltext'])
  35. ->create();
  36. }
  37. }