fix: 🐛 Make migrations be compatible to installed addon
This commit is contained in:
parent
5b95dd4d13
commit
ae9ab59dec
|
@ -1,32 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
class UndoDecimalInPrice extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function up()
|
|
||||||
{
|
|
||||||
Schema::table('products', function (Blueprint $table) {
|
|
||||||
$table->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();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -14,11 +14,16 @@ class AddBillingPeriodToProducts extends Migration
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
|
// User already has installed the addon before
|
||||||
|
if (Schema::hasColumn("products", "billing_period")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Schema::table('products', function (Blueprint $table) {
|
Schema::table('products', function (Blueprint $table) {
|
||||||
|
|
||||||
$table->string('billing_period')->default("hourly");
|
$table->string('billing_period')->default("hourly");
|
||||||
$table->decimal('price', 15, 4)->change();
|
$table->decimal('price', 15, 4)->change();
|
||||||
$table->decimal('minimum_credits', 15, 4)->change();
|
$table->decimal('minimum_credits', 15, 4)->change();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
DB::statement('UPDATE products SET billing_period="hourly"');
|
DB::statement('UPDATE products SET billing_period="hourly"');
|
||||||
|
@ -29,7 +34,6 @@ class AddBillingPeriodToProducts extends Migration
|
||||||
$price = $price / 30 / 24;
|
$price = $price / 30 / 24;
|
||||||
DB::table('products')->where('id', $product->id)->update(['price' => $price]);
|
DB::table('products')->where('id', $product->id)->update(['price' => $price]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -26,8 +26,7 @@ class UpdateUserCreditsDatatype extends Migration
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->unsignedFloat('credits')->default(250)->change();
|
$table->decimal('price', ['11', '2'])->change();
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,6 +14,11 @@ class AddLastBilledFieldToServers extends Migration
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
|
// User already has installed the addon before
|
||||||
|
if (Schema::hasColumn("servers", "last_billed")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Schema::table('servers', function (Blueprint $table) {
|
Schema::table('servers', function (Blueprint $table) {
|
||||||
$table->dateTime('last_billed')->default(DB::raw('CURRENT_TIMESTAMP'))->nullable();
|
$table->dateTime('last_billed')->default(DB::raw('CURRENT_TIMESTAMP'))->nullable();
|
||||||
});
|
});
|
|
@ -13,6 +13,11 @@ class AddCancelationToServersTable extends Migration
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
|
// User already has installed the addon before
|
||||||
|
if (Schema::hasColumn("servers", "cancelled")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Schema::table('servers', function (Blueprint $table) {
|
Schema::table('servers', function (Blueprint $table) {
|
||||||
$table->dateTime('cancelled')->nullable();
|
$table->dateTime('cancelled')->nullable();
|
||||||
});
|
});
|
|
@ -600,5 +600,4 @@
|
||||||
"Billing period": "Billing period",
|
"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",
|
"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"
|
"Caution": "Caution"
|
||||||
"hu": "Hungarian"
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue