add new public repo

This commit is contained in:
Andras Bacsai
2023-04-25 14:43:35 +02:00
parent dd51b002b8
commit 6135c139da
42 changed files with 495 additions and 210 deletions

View File

@@ -13,10 +13,10 @@ return new class extends Migration
{
Schema::create('environments', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->string('name')->unique();
$table->string('name');
$table->foreignId('project_id');
$table->timestamps();
$table->unique(['name', 'project_id']);
});
}

View File

@@ -54,7 +54,7 @@ return new class extends Migration
$table->string('status')->default('exited');
$table->morphs('destination');
$table->nullableMorphs('destination');
$table->morphs('source');
$table->foreignId('environment_id');

View File

@@ -0,0 +1,38 @@
<?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::create('gits', function (Blueprint $table) {
$table->id();
$table->enum('type', ['github', 'gitlab', 'bitbucket', 'custom']);
$table->string('api_url');
$table->string('html_url');
$table->integer('custom_port')->default(22);
$table->string('custom_user')->default('git');
$table->longText('webhook_secret')->nullable();
$table->foreignId('private_key_id')->nullable();
$table->foreignId('project_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('gits');
}
};

View File

@@ -1,32 +0,0 @@
<?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::create('git_deploy_keys', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->string('name')->nullable();
$table->string('url');
$table->foreignId('private_key_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('git_deploy_keys');
}
};

View File

@@ -14,11 +14,5 @@ class EnvironmentSeeder extends Seeder
*/
public function run(): void
{
$project_1 = Project::find(1);
Environment::create([
'id' => 1,
'name' => 'production',
'project_id' => $project_1->id,
]);
}
}

View File

@@ -1,17 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class GitDeployKeySeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
//
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace Database\Seeders;
use App\Models\Git;
use App\Models\PrivateKey;
use App\Models\Project;
use App\Models\Team;
use Illuminate\Database\Seeder;
class GitSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// $project = Project::find(1);
// $private_key_1 = PrivateKey::find(1);
// Git::create([
// 'api_url' => 'https://api.github.com',
// 'html_url' => 'https://github.com',
// 'is_public' => false,
// 'private_key_id' => $private_key_1->id,
// 'project_id' => $project->id,
// ]);
}
}

View File

@@ -38,13 +38,5 @@ class GithubAppSeeder extends Seeder
'private_key_id' => $private_key_2->id,
'team_id' => $root_team->id,
]);
GithubApp::create([
'name' => 'Private GitHub (deployment key)',
'api_url' => 'https://api.github.com',
'html_url' => 'https://github.com',
'is_public' => false,
'private_key_id' => $private_key_1->id,
'team_id' => $root_team->id,
]);
}
}

View File

@@ -12,7 +12,6 @@ class ProjectSeeder extends Seeder
{
$root_team = Team::find(0);
Project::create([
'id' => 1,
'name' => "My first project",
'description' => "This is a test project in development",
'team_id' => $root_team->id,