1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 10:14:04 +00:00

Change string column type to UUID

This commit is contained in:
antonkomarev 2019-09-26 19:24:39 +03:00
parent ee06ff296e
commit 6a5f0acd1d
2 changed files with 8 additions and 8 deletions

View file

@ -13,10 +13,10 @@ class CreateTenantsTable extends Migration
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('tenants', function (Blueprint $table) {
$table->string('id', 36)->primary(); // 36 characters is the default uuid length
$table->uuid('id')->primary();
// (optional) your custom, indexed columns can go here
$table->json('data');
@ -28,8 +28,8 @@ class CreateTenantsTable extends Migration
*
* @return void
*/
public function down()
public function down(): void
{
Schema::drop('tenants');
Schema::dropIfExists('tenants');
}
}

View file

@ -13,11 +13,11 @@ class CreateDomainsTable extends Migration
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('domains', function (Blueprint $table) {
$table->string('domain', 255)->primary();
$table->string('tenant_id', 36);
$table->uuid('tenant_id');
$table->foreign('tenant_id')->references('id')->on('tenants')->onUpdate('cascade')->onDelete('cascade');
});
@ -28,8 +28,8 @@ class CreateDomainsTable extends Migration
*
* @return void
*/
public function down()
public function down(): void
{
Schema::drop('domains');
Schema::dropIfExists('domains');
}
}