Mass changes
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Email;
|
||||
use App\Models\Person\Person;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<Email>
|
||||
*/
|
||||
class EmailFactory extends Factory
|
||||
{
|
||||
protected $model = Email::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'person_id' => Person::factory(),
|
||||
'value' => $this->faker->unique()->safeEmail(),
|
||||
'label' => null,
|
||||
'is_primary' => false,
|
||||
'is_active' => true,
|
||||
'valid' => true,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Import;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ImportFactory extends Factory
|
||||
{
|
||||
protected $model = Import::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'uuid' => (string) Str::uuid(),
|
||||
'user_id' => null,
|
||||
'import_template_id' => null,
|
||||
'client_id' => null,
|
||||
'source_type' => 'csv',
|
||||
'file_name' => 'test.csv',
|
||||
'original_name' => 'test.csv',
|
||||
'disk' => 'local',
|
||||
'path' => 'imports/test.csv',
|
||||
'status' => 'uploaded',
|
||||
'meta' => [
|
||||
'has_header' => true,
|
||||
'forced_delimiter' => ',',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,8 @@ class AddressTypeFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
'name' => $this->faker->randomElement(['Home', 'Work', 'Other']),
|
||||
'description' => $this->faker->optional()->sentence(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Database\Factories\Person;
|
||||
|
||||
use App\Models\Person\AddressType;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
@@ -17,7 +19,10 @@ class PersonAddressFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
'address' => $this->faker->streetAddress(),
|
||||
'country' => 'SI',
|
||||
'type_id' => AddressType::factory(),
|
||||
'user_id' => User::factory(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
use App\Models\Person\PersonGroup;
|
||||
use App\Models\Person\PersonType;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
@@ -29,6 +30,7 @@ public function definition(): array
|
||||
'description' => $this->faker->optional()->sentence(),
|
||||
'group_id' => PersonGroup::factory(),
|
||||
'type_id' => PersonType::factory(),
|
||||
'user_id' => User::factory(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Database\Factories\Person;
|
||||
|
||||
use App\Models\Person\PhoneType;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
@@ -17,7 +19,9 @@ class PersonPhoneFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
'nu' => $this->faker->numerify('06########'),
|
||||
'type_id' => PhoneType::factory(),
|
||||
'user_id' => User::factory(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ class PhoneTypeFactory extends Factory
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
'name' => $this->faker->randomElement(['GSM', 'Home', 'Work']),
|
||||
'description' => $this->faker->optional()->sentence(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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::table('field_job_settings', function (Blueprint $table): void {
|
||||
if (! Schema::hasColumn('field_job_settings', 'action_id')) {
|
||||
$table->foreignId('action_id')->nullable()->constrained('actions')->nullOnDelete()->after('segment_id');
|
||||
$table->index('action_id');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('field_job_settings', function (Blueprint $table): void {
|
||||
if (Schema::hasColumn('field_job_settings', 'action_id')) {
|
||||
$table->dropConstrainedForeignId('action_id');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('import_rows', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('import_rows', 'raw_sha1')) {
|
||||
$table->string('raw_sha1', 40)->nullable()->after('fingerprint')->index();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('import_rows', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('import_rows', 'raw_sha1')) {
|
||||
$table->dropColumn('raw_sha1');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user