Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tag update #6

Merged
merged 16 commits into from
May 30, 2018
Prev Previous commit
Next Next commit
标签表
  • Loading branch information
ro4 committed May 10, 2018
commit 0834266bddfacaf24aa18770c26d51eece2dfff3
32 changes: 32 additions & 0 deletions database/migrations/2018_05_10_105015_create_tags_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateTagsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('wz_tags', function (Blueprint $table) {
$table->increments('id');
$table->string('name', 255)->comment('用户ID')->unique();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('wz_tags');
}
}
34 changes: 34 additions & 0 deletions database/migrations/2018_05_10_105629_create_page_tag_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePageTagTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('wz_page_tag', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('page_id')->comment('页面 ID');
$table->unsignedInteger('tag_id')->comment('标签 ID');
$table->index('page_id', 'idx_page_id');
$table->index('tag_id', 'idx_tag_id');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('wz_page_tag');
}
}