diff --git a/database/migrations/2022_07_21_234818_undo_decimal_in_price.php b/database/migrations/2022_07_21_234818_undo_decimal_in_price.php deleted file mode 100644 index cf4abb69..00000000 --- a/database/migrations/2022_07_21_234818_undo_decimal_in_price.php +++ /dev/null @@ -1,32 +0,0 @@ -decimal('price', 15, 4)->change(); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('products', function (Blueprint $table) { - $table->decimal('price',['11','2'])->change(); - }); - } -} diff --git a/database/migrations/2022_06_16_092704_add_billing_period_to_products.php b/database/migrations/2023_05_08_092704_add_billing_period_to_products.php similarity index 89% rename from database/migrations/2022_06_16_092704_add_billing_period_to_products.php rename to database/migrations/2023_05_08_092704_add_billing_period_to_products.php index ceed9362..c4a7ac9a 100644 --- a/database/migrations/2022_06_16_092704_add_billing_period_to_products.php +++ b/database/migrations/2023_05_08_092704_add_billing_period_to_products.php @@ -14,11 +14,16 @@ class AddBillingPeriodToProducts extends Migration */ public function up() { + // User already has installed the addon before + if (Schema::hasColumn("products", "billing_period")) { + return; + } + Schema::table('products', function (Blueprint $table) { + $table->string('billing_period')->default("hourly"); $table->decimal('price', 15, 4)->change(); $table->decimal('minimum_credits', 15, 4)->change(); - }); DB::statement('UPDATE products SET billing_period="hourly"'); @@ -29,7 +34,6 @@ class AddBillingPeriodToProducts extends Migration $price = $price / 30 / 24; DB::table('products')->where('id', $product->id)->update(['price' => $price]); } - } /** diff --git a/database/migrations/2022_06_16_094402_update_user_credits_datatype.php b/database/migrations/2023_05_08_094402_update_user_credits_datatype.php similarity index 89% rename from database/migrations/2022_06_16_094402_update_user_credits_datatype.php rename to database/migrations/2023_05_08_094402_update_user_credits_datatype.php index ed5922e8..292102cc 100644 --- a/database/migrations/2022_06_16_094402_update_user_credits_datatype.php +++ b/database/migrations/2023_05_08_094402_update_user_credits_datatype.php @@ -26,8 +26,7 @@ class UpdateUserCreditsDatatype extends Migration public function down() { Schema::table('users', function (Blueprint $table) { - $table->unsignedFloat('credits')->default(250)->change(); - + $table->decimal('price', ['11', '2'])->change(); }); } } diff --git a/database/migrations/2022_06_16_095818_add_last_billed_field_to_servers.php b/database/migrations/2023_05_08_095818_add_last_billed_field_to_servers.php similarity index 83% rename from database/migrations/2022_06_16_095818_add_last_billed_field_to_servers.php rename to database/migrations/2023_05_08_095818_add_last_billed_field_to_servers.php index 6b05f3a5..9d43ae96 100644 --- a/database/migrations/2022_06_16_095818_add_last_billed_field_to_servers.php +++ b/database/migrations/2023_05_08_095818_add_last_billed_field_to_servers.php @@ -14,6 +14,11 @@ class AddLastBilledFieldToServers extends Migration */ public function up() { + // User already has installed the addon before + if (Schema::hasColumn("servers", "last_billed")) { + return; + } + Schema::table('servers', function (Blueprint $table) { $table->dateTime('last_billed')->default(DB::raw('CURRENT_TIMESTAMP'))->nullable(); }); diff --git a/database/migrations/2022_07_21_234527_add_cancelation_to_servers_table.php b/database/migrations/2023_05_08_234527_add_cancelation_to_servers_table.php similarity index 82% rename from database/migrations/2022_07_21_234527_add_cancelation_to_servers_table.php rename to database/migrations/2023_05_08_234527_add_cancelation_to_servers_table.php index 15fafb16..0d0f4e20 100644 --- a/database/migrations/2022_07_21_234527_add_cancelation_to_servers_table.php +++ b/database/migrations/2023_05_08_234527_add_cancelation_to_servers_table.php @@ -13,6 +13,11 @@ class AddCancelationToServersTable extends Migration */ public function up() { + // User already has installed the addon before + if (Schema::hasColumn("servers", "cancelled")) { + return; + } + Schema::table('servers', function (Blueprint $table) { $table->dateTime('cancelled')->nullable(); }); diff --git a/lang/en.json b/lang/en.json index 4db85206..90f23aae 100644 --- a/lang/en.json +++ b/lang/en.json @@ -600,5 +600,4 @@ "Billing period": "Billing period", "Upgrading/Downgrading your server will reset your billing cycle to now. Your overpayed Credits will be refunded. The price for the new billing cycle will be withdrawed": "Upgrading/Downgrading your server will reset your billing cycle to now. Your overpayed Credits will be refunded. The price for the new billing cycle will be withdrawed", "Caution": "Caution" - "hu": "Hungarian" }