feat: Remove unique for gitlab_id on site - Close #94
This commit is contained in:
parent
a3529361b7
commit
4d777f6281
3 changed files with 35 additions and 12 deletions
|
|
@ -28,7 +28,7 @@ class StoreSiteRequest extends FormRequest
|
|||
'name' => 'required|string|min:3|max:255',
|
||||
'users' => 'nullable|array',
|
||||
'users.*.id' => 'required|exists:users,id',
|
||||
'gitlab_project_id' => 'nullable|unique:sites,gitlab_project_id',
|
||||
'gitlab_project_id' => 'nullable',
|
||||
'project_manager_id' => 'nullable|exists:users,id',
|
||||
'url_re7' => 'nullable|url',
|
||||
'url_prod' => 'nullable|url'
|
||||
|
|
|
|||
|
|
@ -4,15 +4,4 @@ namespace App\Http\Requests\Bo\Sites;
|
|||
|
||||
class UpdateSiteRequest extends StoreSiteRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return array_merge(parent::rules(), [
|
||||
'gitlab_project_id' => 'nullable|unique:sites,gitlab_project_id,' . $this->route('site')->id . ',id',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
<?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('sites', function (Blueprint $table) {
|
||||
$table->unsignedInteger('gitlab_project_id')
|
||||
->unique(false)
|
||||
->nullable()
|
||||
->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('sites', function (Blueprint $table) {
|
||||
$table->unsignedInteger('gitlab_project_id')
|
||||
->unique(true)
|
||||
->nullable()
|
||||
->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Reference in a new issue