新建systembase表数据迁移
This commit is contained in:
1 parent
663cafe365
commit
a96d656d1b
3 files changed
+91
-2
No files matched your search
+2
-1
@@ -17,7 +17,8 @@
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.6.0",
|
||||
"topthink/framework": "5.1.*"
|
||||
"topthink/framework": "5.1.*",
|
||||
"topthink/think-migration": "^2.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
Generated
+46
-1
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "296bd8a1d28e39d56dcd80ce7be249f3",
|
||||
"content-hash": "b3374c528fb4105b6d3f53e5e315910c",
|
||||
"packages": [
|
||||
{
|
||||
"name": "topthink/framework",
|
||||
@@ -109,6 +109,51 @@
|
||||
}
|
||||
],
|
||||
"time": "2018-05-11T06:45:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "topthink/think-migration",
|
||||
"version": "v2.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/top-think/think-migration.git",
|
||||
"reference": "70c89850ca29c2eab988c7c3475d1d5331901bb8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/top-think/think-migration/zipball/70c89850ca29c2eab988c7c3475d1d5331901bb8",
|
||||
"reference": "70c89850ca29c2eab988c7c3475d1d5331901bb8",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://dl.laravel-china.org/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"topthink/framework": "5.1.*"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Phinx\\": "phinx/src/Phinx",
|
||||
"think\\migration\\": "src"
|
||||
},
|
||||
"files": [
|
||||
"src/config.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"Apache-2.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "yunwuxin",
|
||||
"email": "448901948@qq.com"
|
||||
}
|
||||
],
|
||||
"time": "2017-12-31T16:32:22+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
use think\migration\db\Column;
|
||||
|
||||
class SystemBase 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('system_base');
|
||||
|
||||
// 给当前表添加字段
|
||||
$table->addColumn('title','string',['limit'=>50,'default'=>'学生成绩统计系统','null'=>'false','comment'=>'网站名称'])
|
||||
->addColumn('keywords','string',['limit'=>100,'default'=>'成绩统计,成绩管理','null'=>'false','comment'=>'关键词'])
|
||||
->addColumn('description','string',['limit'=>100,'default'=>'这是我们自己开发的系统','null'=>'false','comment'=>'网站说明'])
|
||||
->addColumn('copyright','string',['limit'=>15,'default'=>'2018-'.date('Y'),'null'=>'false','comment'=>'版权'])
|
||||
->addColumn('thinks','string',['limit'=>200,'default'=>'H-ui前端框架、ThinkPhp框架','null'=>'false','comment'=>'网站感谢'])
|
||||
// ->addIndex(array('username'), array('unique' => true))
|
||||
->create();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user