//参考
private function test(){
$ret_data = [];
//新增表
$ret_data[0][0] = 'tb_add';
$ret_data[0][1] = $this->tb_prefix.'test';
$ret_data[0][2] = ,,,INFO
CREATE TABLE `zf_test` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`content` varchar(255) DEFAULT NULL,
`token` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
INFO;
$ret_data[0][2] = str_replace('zf_test',$this->tb_prefix.'test',$ret_data[0][2]);
// 新增表字段 tb_field_add($sql_is,$sql_add)
$ret_data[1] = [
'tb_field_add',
"show columns from ".$this->tb_prefix."test like 'append'",
"alter table ".$this->tb_prefix."test add append varchar(50) not null"
];
//修改表字段 tb_field_name_edit($sql_is,$sql_add)
$ret_data[2] = [
'tb_field_edit',
"show columns from ".$this->tb_prefix."test like 'name'",
"alter table ".$this->tb_prefix."test MODIFY name varchar(50) NOT NULL "
];
//字段是否存在
// tb_field_is($sql_is)
//show columns from ".$this->tb_prefix."test like 'name'
//表字段删除
// tb_field_del($sql_is,$sql_add)
$ret_data[3] = [
'tb_field_del',
"show columns from ".$this->tb_prefix."test like 'name'",
"alter table ".$this->tb_prefix."test DROP name"
];
//数据的增
$ret_data[3] = [
'tb_post_add',
$this->tb_prefix.'test',
['content'=>1,'token'=>date("Y-m-d",time()),'append'=>11],
true //默认允许重复
];
$ret_data[4] = [
'tb_post_add',
$this->tb_prefix.'test',
['content'=>22222,'token'=>date("Y-m-d",time()),'append'=>11],
false, //是否允许重复
['content'=>22222], //判断条件
];
// 改
$ret_data[5] = [
'tb_post_edit',
$this->tb_prefix.'test',
['content'=>1],
['content'=>'修改啦','token'=>date("Y-m-d",time()),'append'=>11],
];
// 删
$ret_data[6] = [
'tb_post_del',
$this->tb_prefix.'test',
['id'=>7],
];
return $ret_data;
}