feat: init
This commit is contained in:
40
database/migrations/20241224025811_create_contact_us.php
Normal file
40
database/migrations/20241224025811_create_contact_us.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
class CreateContactUs 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('contact_us', ['engine' => 'MyISAM', 'comment' => '联系我们表']);
|
||||
$table->addColumn('language_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('created_at', 'timestamp', ['null' => false, 'default' => 'CURRENT_TIMESTAMP', 'comment' => '创建时间'])
|
||||
->create();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user