mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-06 07:34:02 +00:00
add test
This commit is contained in:
parent
e1229ef446
commit
8aea33c0f2
4 changed files with 228 additions and 2 deletions
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class TestCreateCentralUsersWithExtraFieldsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('central_users', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('global_id')->unique();
|
||||
$table->string('name');
|
||||
$table->string('email');
|
||||
$table->string('password');
|
||||
|
||||
// extra columns
|
||||
$table->string('role');
|
||||
$table->string('code');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('central_users');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class TestCreateTenantCentralUsersPivotTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('tenant_central_users', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('tenant_id');
|
||||
$table->string('global_user_id');
|
||||
|
||||
$table->unique(['tenant_id', 'global_user_id']);
|
||||
|
||||
$table->foreign('tenant_id')->references('id')->on('tenants')->onUpdate('cascade')->onDelete('cascade');
|
||||
$table->foreign('global_user_id')->references('global_id')->on('central_users')->onUpdate('cascade')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('tenant_central_users');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class TestCreateResourceUsersWithNoExtraFieldsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('resource_users', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('global_id')->unique();
|
||||
$table->string('name');
|
||||
$table->string('email');
|
||||
$table->string('password');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('resource_users');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue