Initial commit,修正

This commit is contained in:
2025-07-13 19:37:38 +08:00
parent 38ce288e27
commit 65bbd06981
12384 changed files with 3985464 additions and 8 deletions
@@ -0,0 +1,43 @@
<?php
use mdm\admin\components\Configs;
/**
* Migration table of table_menu
*
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
* @since 1.0
*/
class m140602_111327_create_menu_table extends \yii\db\Migration
{
/**
* @inheritdoc
*/
public function up()
{
$menuTable = Configs::instance()->menuTable;
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
}
$this->createTable($menuTable, [
'id' => $this->primaryKey(),
'name' => $this->string(128)->notNull(),
'parent' => $this->integer(),
'route' => $this->string(),
'order' => $this->integer(),
'data' => $this->binary(),
"FOREIGN KEY ([[parent]]) REFERENCES {$menuTable}([[id]]) ON DELETE SET NULL ON UPDATE CASCADE",
], $tableOptions);
}
/**
* @inheritdoc
*/
public function down()
{
$this->dropTable(Configs::instance()->menuTable);
}
}
+42
View File
@@ -0,0 +1,42 @@
<?php
use yii\db\Migration;
use mdm\admin\components\Configs;
class m160312_050000_create_user extends Migration
{
public function up()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$userTable = Configs::instance()->userTable;
// Check if the table exists
if ($this->db->schema->getTableSchema($userTable, true) === null) {
$this->createTable($userTable, [
'id' => $this->primaryKey(),
'username' => $this->string(32)->notNull(),
'auth_key' => $this->string(32)->notNull(),
'password_hash' => $this->string()->notNull(),
'password_reset_token' => $this->string(),
'email' => $this->string()->notNull(),
'status' => $this->smallInteger()->notNull()->defaultValue(10),
'created_at' => $this->integer()->notNull(),
'updated_at' => $this->integer()->notNull(),
], $tableOptions);
}
}
public function down()
{
$userTable = Configs::instance()->userTable;
if ($this->db->schema->getTableSchema($userTable, true) !== null) {
$this->dropTable($userTable);
}
}
}
+33
View File
@@ -0,0 +1,33 @@
/**
* Database schema required by yii2-admin.
*
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
* @since 2.5
*/
drop table if exists [menu];
drop table if exists [user];
create table [menu]
(
[id] int IDENTITY PRIMARY KEY,
[name] varchar(128),
[parent] int(11),
[route] varchar(256),
[order] int(11),
[data] text,
foreign key (parent) references [menu]([id]) ON DELETE SET NULL ON UPDATE CASCADE
);
create table [user]
(
[id] int IDENTITY PRIMARY KEY,
[username] varchar(32) NOT NULL,
[auth_key] varchar(32) NOT NULL,
[password_hash] varchar(256) NOT NULL,
[password_reset_token] varchar(256),
[email] varchar(256) NOT NULL,
[status] integer not null default 10,
[created_at] integer not null,
[updated_at] integer not null
);
+33
View File
@@ -0,0 +1,33 @@
/**
* Database schema required by yii2-admin.
*
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
* @since 2.5
*/
drop table if exists `menu`;
drop table if exists `user` cascade;
create table `menu`
(
`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` varchar(128),
`parent` int(11),
`route` varchar(256),
`order` int(11),
`data` blob,
foreign key (`parent`) references `menu`(`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
create table `user`
(
`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`username` varchar(32) NOT NULL,
`auth_key` varchar(32) NOT NULL,
`password_hash` varchar(256) NOT NULL,
`password_reset_token` varchar(256),
`email` varchar(256) NOT NULL,
`status` integer not null default 10,
`created_at` integer not null,
`updated_at` integer not null
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
+33
View File
@@ -0,0 +1,33 @@
/**
* Database schema required by yii2-admin.
*
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
* @since 2.5
*/
drop table if exists "menu";
drop table if exists "user";
create table "menu"
(
"id" NUMBER(10) NOT NULL PRIMARY KEY,
"name" varchar(128),
"parent" number(10),
"route" varchar(256),
"order" number(10),
"data" BYTEA,
foreign key (parent) references "menu"("id") ON DELETE SET NULL ON UPDATE CASCADE
);
create table "user"
(
"id" NUMBER(10) NOT NULL PRIMARY KEY,
"username" varchar(32) NOT NULL,
"auth_key" varchar(32) NOT NULL,
"password_hash" varchar(256) NOT NULL,
"password_reset_token" varchar(256),
"email" varchar(256) NOT NULL,
"status" integer not null default 10,
"created_at" number(10) not null,
"updated_at" number(10) not null
);
+33
View File
@@ -0,0 +1,33 @@
/**
* Database schema required by yii2-admin.
*
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
* @since 2.5
*/
drop table if exists "menu";
drop table if exists "user";
create table "menu"
(
"id" serial NOT NULL PRIMARY KEY,
"name" varchar(128),
"parent" integer,
"route" varchar(256),
"order" integer,
"data" bytea,
foreign key ("parent") references "menu"("id") ON DELETE SET NULL ON UPDATE CASCADE
);
create table "user"
(
"id" serial NOT NULL PRIMARY KEY,
"username" varchar(32) NOT NULL,
"auth_key" varchar(32) NOT NULL,
"password_hash" varchar(256) NOT NULL,
"password_reset_token" varchar(256),
"email" varchar(256) NOT NULL,
"status" integer not null default 10,
"created_at" integer not null,
"updated_at" integer not null
);
+33
View File
@@ -0,0 +1,33 @@
/**
* Database schema required by yii2-admin.
*
* @author Misbahul D Munir <misbahuldmunir@gmail.com>
* @since 2.5
*/
drop table if exists "menu";
drop table if exists "user";
create table "menu"
(
"id" integer PRIMARY KEY AUTOINCREMENT NOT NULL,
"name" varchar(128),
"parent" int(11),
"route" varchar(256),
"order" int(11),
"data" LONGBLOB,
foreign key ("parent") references "menu"("id") ON DELETE SET NULL ON UPDATE CASCADE
);
create table "user"
(
"id" integer PRIMARY KEY AUTOINCREMENT NOT NULL,
"username" varchar(32) NOT NULL,
"auth_key" varchar(32) NOT NULL,
"password_hash" varchar(256) NOT NULL,
"password_reset_token" varchar(256),
"email" varchar(256) NOT NULL,
"status" integer not null default 10,
"created_at" integer not null,
"updated_at" integer not null
);