mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 15:34:04 +00:00
Change string column type to UUID
This commit is contained in:
parent
ee06ff296e
commit
6a5f0acd1d
2 changed files with 8 additions and 8 deletions
|
|
@ -13,10 +13,10 @@ class CreateTenantsTable extends Migration
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('tenants', function (Blueprint $table) {
|
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
|
// (optional) your custom, indexed columns can go here
|
||||||
|
|
||||||
$table->json('data');
|
$table->json('data');
|
||||||
|
|
@ -28,8 +28,8 @@ class CreateTenantsTable extends Migration
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::drop('tenants');
|
Schema::dropIfExists('tenants');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,11 @@ class CreateDomainsTable extends Migration
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('domains', function (Blueprint $table) {
|
Schema::create('domains', function (Blueprint $table) {
|
||||||
$table->string('domain', 255)->primary();
|
$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');
|
$table->foreign('tenant_id')->references('id')->on('tenants')->onUpdate('cascade')->onDelete('cascade');
|
||||||
});
|
});
|
||||||
|
|
@ -28,8 +28,8 @@ class CreateDomainsTable extends Migration
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function down()
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::drop('domains');
|
Schema::dropIfExists('domains');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue