Настругал миграций
This commit is contained in:
		
							parent
							
								
									321419c0f0
								
							
						
					
					
						commit
						31ab6932fe
					
				|  | @ -0,0 +1,29 @@ | |||
| <?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('wishes', function (Blueprint $table) { | ||||
|             $table->unsignedBigInteger('book_user_id')->nullable(); | ||||
|             $table->foreign('book_user_id')->references('id')->on('users'); | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Reverse the migrations. | ||||
|      */ | ||||
|     public function down(): void | ||||
|     { | ||||
|         Schema::table('wishes', function (Blueprint $table) { | ||||
|             $table->dropColumn('book_user_id'); | ||||
|         }); | ||||
|     } | ||||
| }; | ||||
|  | @ -0,0 +1,28 @@ | |||
| <?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('users', function (Blueprint $table) { | ||||
|             $table->string('name')->unique(true)->change(); | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Reverse the migrations. | ||||
|      */ | ||||
|     public function down(): void | ||||
|     { | ||||
|         Schema::table('users', function (Blueprint $table) { | ||||
|             $table->string('name')->unique(false)->change(); | ||||
|         }); | ||||
|     } | ||||
| }; | ||||
		Loading…
	
		Reference in New Issue