Move services onto new services system, includes tests
This commit is contained in:
parent
e91079d128
commit
90bbe57148
26 changed files with 899 additions and 272 deletions
|
@ -88,6 +88,17 @@ $factory->define(Pterodactyl\Models\Node::class, function (Faker\Generator $fake
|
|||
];
|
||||
});
|
||||
|
||||
$factory->define(Pterodactyl\Models\Service::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'author' => $faker->unique()->uuid,
|
||||
'name' => $faker->word,
|
||||
'description' => null,
|
||||
'folder' => strtolower($faker->unique()->word),
|
||||
'startup' => 'java -jar test.jar',
|
||||
'index_file' => 'indexjs',
|
||||
];
|
||||
});
|
||||
|
||||
$factory->define(Pterodactyl\Models\ServiceOption::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'id' => $faker->unique()->randomNumber(),
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CascadeDeletionWhenAParentServiceIsDeleted extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('service_options', function (Blueprint $table) {
|
||||
$table->dropForeign(['service_id']);
|
||||
|
||||
$table->foreign('service_id')->references('id')->on('services')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('service_options', function (Blueprint $table) {
|
||||
$table->dropForeign(['service_id']);
|
||||
|
||||
$table->foreign('service_id')->references('id')->on('services');
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue