56 lines
1.5 KiB
PHP
56 lines
1.5 KiB
PHP
<?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('sites', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->timestamps();
|
|
$table->boolean('active')->default('FALSE');
|
|
$table->string('site')->unique();
|
|
$table->string('redirect')->nullable();
|
|
$table->integer('delay')->nullable();
|
|
$table->text('message')->nullable();
|
|
$table->boolean('permanent')->default(FALSE);
|
|
});
|
|
|
|
Schema::create('site_uris', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->timestamps();
|
|
$table->boolean('active')->default('FALSE');
|
|
$table->string('uri');
|
|
$table->bigInteger('hits');
|
|
$table->string('redirect')->nullable();
|
|
$table->integer('delay')->nullable();
|
|
$table->text('message')->nullable();
|
|
$table->boolean('permanent')->default(FALSE);
|
|
|
|
$table->integer('site_id');
|
|
$table->foreign('site_id')->references('id')->on('sites');
|
|
|
|
$table->unique(['site_id','uri']);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('site_uris');
|
|
Schema::dropIfExists('sites');
|
|
}
|
|
};
|