diff --git a/src/database/migrations/2020_06_04_115409_create_powerdns_tables.php b/src/database/migrations/2020_06_04_115409_create_powerdns_tables.php index 1cad5d22..1f40f025 100644 --- a/src/database/migrations/2020_06_04_115409_create_powerdns_tables.php +++ b/src/database/migrations/2020_06_04_115409_create_powerdns_tables.php @@ -1,147 +1,147 @@ bigIncrements('id'); $table->string('name', 255)->unique()->index(); $table->string('master', 128)->nullable(); $table->datetime('last_check')->nullable(); $table->string('type', 6)->default('NATIVE'); $table->integer('notified_serial')->unsigned()->nullable(); $table->string('account', 40)->nullable(); $table->timestamps(); } ); Schema::create( 'powerdns_records', function (Blueprint $table) { $table->bigIncrements('id'); $table->bigInteger('domain_id')->unsigned(); $table->string('name', 255)->nullable(); $table->string('type', 10)->nullable(); $table->longtext('content')->nullable(); $table->integer('ttl')->unsigned()->nullable(); $table->integer('prio')->unsigned()->nullable(); $table->boolean('disabled')->default(false); - $table->binary('ordername', 255)->nullable(); + $table->binary('ordername')->nullable(); $table->boolean('auth')->default(true); $table->timestamps(); $table->foreign('domain_id')->references('id')->on('powerdns_domains') ->onDelete('cascade'); $table->index('domain_id'); $table->index(['name', 'type']); //$table->index('ordername'); } ); Schema::create( 'powerdns_masters', function (Blueprint $table) { $table->string('ip', 64); $table->string('nameserver', 255); $table->string('account', 40); $table->primary(['ip', 'nameserver']); $table->timestamps(); } ); Schema::create( 'powerdns_comments', function (Blueprint $table) { $table->bigIncrements('id'); $table->bigInteger('domain_id')->unsigned(); $table->string('name', 255); $table->string('type', 10); $table->string('account', 40)->nullable(); $table->text('comment'); $table->timestamps(); $table->index(['name', 'type']); $table->index(['domain_id', 'updated_at']); $table->foreign('domain_id')->references('id')->on('powerdns_domains') ->onDelete('cascade'); } ); Schema::create( 'powerdns_domain_settings', function (Blueprint $table) { $table->bigIncrements('id'); $table->bigInteger('domain_id')->unsigned(); $table->string('kind', 32); $table->text('content'); $table->timestamps(); $table->foreign('domain_id')->references('id')->on('powerdns_domains') ->onDelete('cascade'); } ); Schema::create( 'powerdns_cryptokeys', function (Blueprint $table) { $table->bigIncrements('id'); $table->bigInteger('domain_id')->unsigned(); $table->integer('flags'); $table->boolean('active'); $table->text('content'); $table->timestamps(); $table->index('domain_id'); $table->foreign('domain_id')->references('id')->on('powerdns_domains') ->onDelete('cascade'); } ); Schema::create( 'powerdns_tsigkeys', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name', 255); $table->string('algorithm', 50); $table->string('secret', 255); $table->timestamps(); $table->index(['name', 'algorithm']); } ); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('powerdns_tsigkeys'); Schema::dropIfExists('powerdns_cryptokeys'); Schema::dropIfExists('powerdns_domain_settings'); Schema::dropIfExists('powerdns_comments'); Schema::dropIfExists('powerdns_masters'); Schema::dropIfExists('powerdns_records'); Schema::dropIfExists('powerdns_domains'); } } diff --git a/src/database/migrations/2021_03_25_100000_signup_code_refactor.php b/src/database/migrations/2021_03_25_100000_signup_code_refactor.php index 48c65510..64e17d42 100644 --- a/src/database/migrations/2021_03_25_100000_signup_code_refactor.php +++ b/src/database/migrations/2021_03_25_100000_signup_code_refactor.php @@ -1,117 +1,118 @@ string('email'); $table->string('first_name')->nullable(); $table->string('last_name')->nullable(); $table->string('plan', 128)->nullable(); $table->string('voucher', 32)->nullable(); $table->string('local_part')->nullable(); $table->string('domain_part')->nullable(); $table->string('ip_address')->nullable(); $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->useCurrent(); $table->softDeletes(); } ); DB::table('signup_codes')->get()->each(function ($code) { + /** @var \App\SignupCode $code */ if (empty($code->data)) { return; } $data = json_decode($code->data); if (!empty($data->email)) { $parts = explode('@', $data->email); - $data->local_part = $parts[0] ?? null; - $data->domain_part = $parts[1] ?? null; + $data->local_part = $parts[0] ?? null; // @phpstan-ignore-line + $data->domain_part = $parts[1] ?? null; // @phpstan-ignore-line } DB::table('signup_codes') ->where('code', $code->code) ->update([ 'email' => $data->email ?? null, 'first_name' => $data->first_name ?? null, 'last_name' => $data->last_name ?? null, 'plan' => $data->plan ?? null, 'voucher' => $data->voucher ?? null, 'local_part' => $data->local_part ?? null, 'domain_part' => $data->domain_part ?? null, ]); }); Schema::table( 'signup_codes', function (Blueprint $table) { $table->dropColumn('data'); } ); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::table( 'signup_codes', function (Blueprint $table) { $table->text('data'); } ); DB::table('signup_codes')->get()->each(function ($code) { $data = json_encode([ 'email' => $code->email, 'first_name' => $code->first_name, 'last_name' => $code->last_name, 'plan' => $code->plan, 'voucher' => $code->voucher, ]); DB::table('signup_codes') ->where('code', $code->code) ->update(['data' => $data]); }); Schema::table( 'signup_codes', function (Blueprint $table) { $table->dropColumn([ 'created_at', 'updated_at', 'deleted_at', 'ip_address', 'email', 'local_part', 'domain_part', 'first_name', 'last_name', 'plan', 'voucher', ]); } ); } } diff --git a/src/phpstan.neon b/src/phpstan.neon index 3e78fa38..d255f487 100644 --- a/src/phpstan.neon +++ b/src/phpstan.neon @@ -1,17 +1,19 @@ includes: - ./vendor/nunomaduro/larastan/extension.neon parameters: ignoreErrors: - '#Access to an undefined property [a-zA-Z\\]+::\$pivot#' + - '#Access to undefined constant static\(App\\[a-zA-Z]+\)::STATUS_[A-Z_]+#' - '#Call to an undefined [a-zA-Z0-9<>\\ ]+::withEnvTenantContext\(\)#' - '#Call to an undefined [a-zA-Z0-9<>\\ ]+::withObjectTenantContext\(\)#' - '#Call to an undefined [a-zA-Z0-9<>\\ ]+::withSubjectTenantContext\(\)#' - '#Call to an undefined method Tests\\Browser::#' - - '#Access to undefined constant static\(App\\[a-zA-Z]+\)::STATUS_[A-Z_]+#' + - '#Call to an undefined method Illuminate\\Support\\Fluent::references\(\)#' level: 4 parallel: processTimeout: 300.0 paths: - app/ - config/ + - database/ - tests/