Add project repository connection settings
This commit is contained in:
@@ -16,6 +16,7 @@ class DatabaseSeeder extends Seeder
|
||||
UserSeeder::class,
|
||||
UserGitConnectionSeeder::class,
|
||||
ProjectSeeder::class,
|
||||
RepositoryConnectionSeeder::class,
|
||||
BoardColumnSeeder::class,
|
||||
ProjectTicketMetadataSeeder::class,
|
||||
TicketSeeder::class,
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Actions\Git\GitProviderKey;
|
||||
use App\Models\Project;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class RepositoryConnectionSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$project = Project::query()->where('key', 'CORE')->first()
|
||||
?? Project::query()->orderBy('id')->first();
|
||||
|
||||
if ($project === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$project->repositoryConnections()->firstOrCreate(
|
||||
[
|
||||
'provider' => GitProviderKey::Gitea,
|
||||
'base_url' => 'https://git.example.test',
|
||||
'provider_repository_id' => '501',
|
||||
],
|
||||
[
|
||||
'owner_name' => 'core-team',
|
||||
'repository_name' => 'kanbangit',
|
||||
'repository_full_name' => 'core-team/kanbangit',
|
||||
'repository_url' => 'https://git.example.test/core-team/kanbangit',
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user