| 
									
										
										
										
											2021-12-07 22:55:11 +08:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | use Illuminate\Database\Migrations\Migration; | 
					
						
							|  |  |  | use Illuminate\Database\Schema\Blueprint; | 
					
						
							|  |  |  | use Illuminate\Support\Facades\Schema; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-07 00:58:29 +08:00
										 |  |  | return new class extends Migration | 
					
						
							| 
									
										
										
										
											2021-12-07 22:55:11 +08:00
										 |  |  | { | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Run the migrations. | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2024-03-17 23:29:09 +08:00
										 |  |  |     public function up(): void | 
					
						
							| 
									
										
										
										
											2021-12-07 22:55:11 +08:00
										 |  |  |     { | 
					
						
							|  |  |  |         Schema::create('webhooks', function (Blueprint $table) { | 
					
						
							|  |  |  |             $table->increments('id'); | 
					
						
							|  |  |  |             $table->string('name', 150); | 
					
						
							| 
									
										
										
										
											2021-12-13 01:39:06 +08:00
										 |  |  |             $table->boolean('active'); | 
					
						
							| 
									
										
										
										
											2021-12-07 22:55:11 +08:00
										 |  |  |             $table->string('endpoint', 500); | 
					
						
							|  |  |  |             $table->timestamps(); | 
					
						
							| 
									
										
										
										
											2021-12-09 01:35:58 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |             $table->index('name'); | 
					
						
							| 
									
										
										
										
											2021-12-13 01:39:06 +08:00
										 |  |  |             $table->index('active'); | 
					
						
							| 
									
										
										
										
											2021-12-09 01:35:58 +08:00
										 |  |  |         }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         Schema::create('webhook_tracked_events', function (Blueprint $table) { | 
					
						
							|  |  |  |             $table->increments('id'); | 
					
						
							|  |  |  |             $table->integer('webhook_id'); | 
					
						
							|  |  |  |             $table->string('event', 50); | 
					
						
							|  |  |  |             $table->timestamps(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             $table->index('event'); | 
					
						
							|  |  |  |             $table->index('webhook_id'); | 
					
						
							| 
									
										
										
										
											2021-12-07 22:55:11 +08:00
										 |  |  |         }); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Reverse the migrations. | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2024-03-17 23:29:09 +08:00
										 |  |  |     public function down(): void | 
					
						
							| 
									
										
										
										
											2021-12-07 22:55:11 +08:00
										 |  |  |     { | 
					
						
							|  |  |  |         Schema::dropIfExists('webhooks'); | 
					
						
							| 
									
										
										
										
											2021-12-10 22:58:14 +08:00
										 |  |  |         Schema::dropIfExists('webhook_tracked_events'); | 
					
						
							| 
									
										
										
										
											2021-12-07 22:55:11 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-02-07 00:58:29 +08:00
										 |  |  | }; |