datatable.directory codebase
https://datatable.directory/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.8 KiB
66 lines
1.8 KiB
<?php
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
class CreateDataTablesTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('data_tables', function (Blueprint $table) {
|
|
$table->increments('id');
|
|
$table->timestamps();
|
|
$table->unsignedInteger('owner_id');
|
|
$table->unsignedInteger('parent_data_table_id')->nullable();
|
|
$table->string('title');
|
|
$table->string('license');
|
|
|
|
$table->foreign('owner_id')
|
|
->references('id')->on('users')
|
|
->onDelete('cascade');
|
|
|
|
$table->foreign('parent_data_table_id')
|
|
->references('id')->on('data_tables')
|
|
->onDelete('set null');
|
|
});
|
|
|
|
Schema::create('table_revisions', function (Blueprint $table) {
|
|
$table->increments('id');
|
|
$table->timestamps();
|
|
$table->boolean('approved');
|
|
$table->unsignedInteger('data_table_id');
|
|
$table->unsignedInteger('parent_revision_id')->nullable();
|
|
$table->unsignedInteger('author_id')->nullable();
|
|
$table->longText('content');
|
|
|
|
$table->foreign('data_table_id')
|
|
->references('id')->on('data_tables')
|
|
->onDelete('cascade');
|
|
|
|
$table->foreign('parent_revision_id')
|
|
->references('id')->on('table_revisions')
|
|
->onDelete('set null');
|
|
|
|
$table->foreign('author_id')
|
|
->references('id')->on('users')
|
|
->onDelete('set null');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('table_revisions');
|
|
Schema::dropIfExists('data_tables');
|
|
}
|
|
}
|
|
|