Skip to content

Commit

Permalink
feat: use migration over artisan call
Browse files Browse the repository at this point in the history
  • Loading branch information
ScuffedNewt committed Aug 28, 2024
1 parent 269c2e2 commit d6bdcf1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ Add basic site data:
$ php artisan add-site-settings
$ php artisan add-text-pages
$ php artisan copy-default-images
$ php artisan convert-character-subtype
```

Finally, set up the admin account for logging in:
Expand Down
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
{
//
if (!Schema::hasTable('character_image_subtypes')) {
$this->call('convert-character-subtype');
}

// check call was successful
if (!Schema::hasTable('character_image_subtypes')) {
throw new \Exception('The character_image_subtypes table does not exist.');
}
}

/**
* Reverse the migrations.
*/
public function down(): void
{
//
throw new \Exception('This migration cannot be reversed.');
}
};

0 comments on commit d6bdcf1

Please sign in to comment.