forked from laravel-shift/blueprint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from rcrosbourne/feature/add-ulid-column-type
Feature/add ulid column type
- Loading branch information
Showing
6 changed files
with
176 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
models: | ||
Journey: | ||
id: ulid primary | ||
name: string | ||
user_id: ulid foreign | ||
relationships: | ||
belongsToMany: Diary | ||
Diary: | ||
id: ulid primary | ||
relationships: | ||
belongsToMany: Journey |
31 changes: 31 additions & 0 deletions
31
tests/fixtures/migrations/belongs-to-many-pivot-using-ulids.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::disableForeignKeyConstraints(); | ||
|
||
Schema::create('diary_journey', function (Blueprint $table) { | ||
$table->foreignUlid('diary_id'); | ||
$table->foreignUlid('journey_id'); | ||
}); | ||
|
||
Schema::enableForeignKeyConstraints(); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::dropIfExists('diary_journey'); | ||
} | ||
}; |
31 changes: 31 additions & 0 deletions
31
tests/fixtures/migrations/belongs-to-many-using-ulids-diary-model.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::disableForeignKeyConstraints(); | ||
|
||
Schema::create('diaries', function (Blueprint $table) { | ||
$table->ulid('id')->primary(); | ||
$table->timestamps(); | ||
}); | ||
|
||
Schema::enableForeignKeyConstraints(); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::dropIfExists('diaries'); | ||
} | ||
}; |
33 changes: 33 additions & 0 deletions
33
tests/fixtures/migrations/belongs-to-many-using-ulids-journey-model.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::disableForeignKeyConstraints(); | ||
|
||
Schema::create('journeys', function (Blueprint $table) { | ||
$table->ulid('id')->primary(); | ||
$table->string('name'); | ||
$table->foreignUlid('user_id')->constrained(); | ||
$table->timestamps(); | ||
}); | ||
|
||
Schema::enableForeignKeyConstraints(); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::dropIfExists('journeys'); | ||
} | ||
}; |