diff --git a/database/migrations/2023_02_12_233014_add_billing_cycle_to_hosts_table.php b/database/migrations/2023_02_12_233014_add_billing_cycle_to_hosts_table.php new file mode 100644 index 0000000..3e61a75 --- /dev/null +++ b/database/migrations/2023_02_12_233014_add_billing_cycle_to_hosts_table.php @@ -0,0 +1,48 @@ +enum('billing_cycle', [ + 'monthly', + 'quarterly', + 'semi-annually', + 'annually', + 'biennially', + 'triennially', + ])->nullable()->index()->after('status'); + + $table->dateTime('next_due_at')->nullable()->after('billing_cycle')->index(); + }); + + $raw = \Illuminate\Support\Facades\DB::raw("ALTER TABLE `hosts` CHANGE `status` `status` ENUM('draft', 'running','stopped','error','suspended','pending','unavailable','locked') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending';"); + \Illuminate\Support\Facades\DB::statement($raw); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down(): void + { + Schema::table('hosts', function (Blueprint $table) { + $table->dropColumn('billing_cycle'); + $table->dropColumn('next_due_at'); + }); + + $raw = \Illuminate\Support\Facades\DB::raw("ALTER TABLE `hosts` CHANGE `status` `status` ENUM('running','stopped','error','suspended','pending','unavailable','locked') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending';"); + \Illuminate\Support\Facades\DB::statement($raw); + } +};