feat: init
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
class CreateArticleLeaveMessage extends Migrator
|
||||
{
|
||||
/**
|
||||
* Change Method.
|
||||
*
|
||||
* Write your reversible migrations using this method.
|
||||
*
|
||||
* More information on writing migrations is available here:
|
||||
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
|
||||
*
|
||||
* The following commands can be used in this method and Phinx will
|
||||
* automatically reverse them when rolling back:
|
||||
*
|
||||
* createTable
|
||||
* renameTable
|
||||
* addColumn
|
||||
* renameColumn
|
||||
* addIndex
|
||||
* addForeignKey
|
||||
*
|
||||
* Remember to call "create()" or "update()" and NOT "save()" when working
|
||||
* with the Table class.
|
||||
*/
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('article_leave_message', ['engine' => 'MyISAM', 'comment' => '文章留言表']);
|
||||
$table->addColumn('article_id', 'integer', ['signed' => false, 'null' => false, 'comment' => '文章ID'])
|
||||
->addColumn('name', 'string', ['limit' => 64, 'null' => false, 'comment' => '姓名'])
|
||||
->addColumn('email', 'string', ['limit' => 128, 'null' => false, 'comment' => '邮箱'])
|
||||
->addColumn('content', 'text', ['null' => false, 'comment' => '内容'])
|
||||
->addColumn('ip', 'string', ['limit' => 64, 'null' => false, 'comment' => 'IP'])
|
||||
->addColumn('user_agent', 'string', ['limit' => 255, 'null' => false, 'comment' => 'UserAgent'])
|
||||
->addColumn('is_audited', 'boolean', ['null' => false, 'default' => 0, 'comment' => '0待审核,1已审核'])
|
||||
->addColumn('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
|
||||
->create();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user