feat: cms first commit
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cms_user', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('nickname', 50)->comment('昵称');
|
||||
$table->string('password')->comment('密码');
|
||||
$table->string('email', 100)->comment('邮箱');
|
||||
$table->string('homepage')->comment('主页地址');
|
||||
$table->string('active_key')->comment('激活码');
|
||||
$table->tinyInteger('status')->default(0)->comment('状态 0 无需激活 1 未激活 2 激活');
|
||||
$table->creatorId();
|
||||
$table->createdAt();
|
||||
$table->updatedAt();
|
||||
$table->deletedAt();
|
||||
|
||||
$table->engine='InnoDB';
|
||||
$table->comment('用户管理表');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cms_user');
|
||||
}
|
||||
};
|
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cms_user_meta', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('user_id')->nullable()->comment('用户ID');
|
||||
$table->string('key')->nullable()->comment('元数据的 key');
|
||||
$table->string('value')->nullable()->comment('元数据的值');
|
||||
$table->createdAt();
|
||||
$table->updatedAt();
|
||||
$table->deletedAt();
|
||||
|
||||
$table->engine='InnoDB';
|
||||
$table->comment('用户关联的元数据表');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cms_user_meta');
|
||||
}
|
||||
};
|
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cms_comment', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('parent_id')->comment('父级ID');
|
||||
$table->integer('user_id')->default(0)->comment('用户ID,不一定存在');
|
||||
$table->integer('post_id')->default(0)->comment('文章ID');
|
||||
$table->string('author')->nullable()->comment('作者');
|
||||
$table->string('author_email')->comment('作者邮箱');
|
||||
$table->string('author_homepage')->comment('作者的主页');
|
||||
$table->string('author_ip')->comment('ip地址');
|
||||
$table->text('content')->comment('评论内容');
|
||||
$table->tinyInteger('is_approved')->default(1)->comment('1 未批准 2 批准');
|
||||
$table->string('user_agent')->comment('评论者的USER AGENT');
|
||||
$table->string('type')->default(1)->comment('评论类型 1 普通 2 回复');
|
||||
$table->creatorId();
|
||||
$table->createdAt();
|
||||
$table->updatedAt();
|
||||
$table->deletedAt();
|
||||
|
||||
$table->engine='InnoDB';
|
||||
$table->comment('评论表');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cms_comment');
|
||||
}
|
||||
};
|
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cms_comment_mata', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('comment_id')->comment('评论ID');
|
||||
$table->string('key')->comment('评论元数据 KEY');
|
||||
$table->string('value')->comment('评论元数据 Value');
|
||||
$table->createdAt();
|
||||
$table->updatedAt();
|
||||
$table->deletedAt();
|
||||
|
||||
$table->engine='InnoDB';
|
||||
$table->comment('评论元数据表');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cms_comment_mata');
|
||||
}
|
||||
};
|
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cms_links', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->comment('链接名称');
|
||||
$table->string('url')->comment('链接的 URL');
|
||||
$table->string('image')->comment('链接图片');
|
||||
$table->tinyInteger('is_target')->default(1)->comment('打开方式 1 本窗口打开 2 新窗口打开');
|
||||
$table->tinyText('description')->comment('描述');
|
||||
$table->tinyInteger('is_visible')->default(1)->comment('是否可见 1 不可见 2 可见');
|
||||
$table->integer('rating')->comment('评分等级');
|
||||
$table->string('rel')->comment('友情链接');
|
||||
$table->string('rel_notes', 1000)->comment('友情链接注释');
|
||||
$table->string('rss')->comment('rss 链接地址');
|
||||
$table->creatorId();
|
||||
$table->createdAt();
|
||||
$table->updatedAt();
|
||||
$table->deletedAt();
|
||||
|
||||
$table->engine='InnoDB';
|
||||
$table->comment('链接表');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cms_links');
|
||||
}
|
||||
};
|
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cms_options', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('key')->comment('key');
|
||||
$table->text('value')->comment('value 值');
|
||||
$table->tinyInteger('autoload')->default(1)->comment('是否自动载入 1 是 2 否');
|
||||
$table->creatorId();
|
||||
$table->createdAt();
|
||||
$table->updatedAt();
|
||||
$table->deletedAt();
|
||||
|
||||
$table->engine='InnoDB';
|
||||
$table->comment('选项, key value');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cms_options');
|
||||
}
|
||||
};
|
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cms_posts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('author')->comment('作者');
|
||||
$table->string('title')->comment('标题');
|
||||
$table->longText('content')->comment('内容');
|
||||
$table->tinyText('excerpt')->comment('摘录');
|
||||
$table->tinyInteger('status')->default(1)->comment('文章状态 1 草稿 2 发布');
|
||||
$table->tinyInteger('is_can_comment')->default(1)->comment('是否可以评论 1 可以 2 不可以');
|
||||
$table->string('password')->comment('文章查看密码');
|
||||
$table->integer('order')->default(1)->comment('排序 默认 1');
|
||||
$table->integer('user_id')->default(0)->comment('用户ID 0 未知');
|
||||
$table->tinyInteger('type')->default(1)->comment('文章类型 1 文章 2 页面');
|
||||
$table->integer('comment_count')->default(0)->comment('评论总数');
|
||||
$table->creatorId();
|
||||
$table->createdAt();
|
||||
$table->updatedAt();
|
||||
$table->deletedAt();
|
||||
|
||||
$table->engine='InnoDB';
|
||||
$table->comment('文章内容表');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cms_posts');
|
||||
}
|
||||
};
|
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cms_category_meta', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('category_id')->comment('分类ID');
|
||||
$table->string('key')->comment('元数据key');
|
||||
$table->string('value')->comment('元数据的值');
|
||||
$table->creatorId();
|
||||
$table->createdAt();
|
||||
$table->updatedAt();
|
||||
$table->deletedAt();
|
||||
|
||||
$table->engine='InnoDB';
|
||||
$table->comment('分类元数据');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cms_category_meta');
|
||||
}
|
||||
};
|
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cms_catetory_relationships', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('category_id')->comment('分类ID');
|
||||
$table->integer('object_id')->comment('文章ID/链接ID');
|
||||
$table->tinyInteger('type')->default(1)->comment('类型 1 文章 2 链接');
|
||||
$table->creatorId();
|
||||
$table->createdAt();
|
||||
$table->updatedAt();
|
||||
$table->deletedAt();
|
||||
|
||||
$table->engine='InnoDB';
|
||||
$table->comment('分类关系');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cms_catetory_relationships');
|
||||
}
|
||||
};
|
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cms_category', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('parent_id')->default(0)->comment('父级ID');
|
||||
$table->string('name')->comment('名称');
|
||||
$table->string('slug')->comment('缩略名');
|
||||
$table->integer('order')->default(1)->comment('排序 默认 1');
|
||||
$table->integer('post_count')->default(0)->comment('文章数量');
|
||||
$table->creatorId();
|
||||
$table->createdAt();
|
||||
$table->updatedAt();
|
||||
$table->deletedAt();
|
||||
|
||||
$table->engine='InnoDB';
|
||||
$table->comment('分类');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cms_category');
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user