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

Размер файла: 961B
  1. <?php
  2.  
  3. use Phinx\Migration\AbstractMigration;
  4.  
  5. class CreateCommentsTable extends AbstractMigration
  6. {
  7. /**
  8. * Change Method.
  9. */
  10. public function change()
  11. {
  12. $table = $this->table('comments', ['collation' => 'utf8mb4_unicode_ci']);
  13. $table->addColumn('user', 'string', ['limit' => 20])
  14. ->addColumn('relate_type', 'enum', ['values' => array('blog','event','down','news','offer','gallery')])
  15. ->addColumn('relate_category_id', 'integer', ['signed' => false])
  16. ->addColumn('relate_id', 'integer', ['signed' => false])
  17. ->addColumn('text', 'text', ['null' => true])
  18. ->addColumn('ip', 'string', ['limit' => 15])
  19. ->addColumn('brow', 'string', ['limit' => 25])
  20. ->addColumn('time', 'integer', ['signed' => false])
  21. ->addIndex(['relate_type', 'relate_id'], ['name' => 'relate_type'])
  22. ->addIndex('time')
  23. ->create();
  24. }
  25. }