mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-20 12:15:02 +00:00
frontend/backend update
This commit is contained in:
+69
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePlansTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create(config('rinvex.subscriptions.tables.plans'), function (Blueprint $table) {
|
||||
// Columns
|
||||
$table->increments('id');
|
||||
$table->string('slug');
|
||||
$table->{$this->jsonable()}('name');
|
||||
$table->{$this->jsonable()}('description')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->decimal('price')->default('0.00');
|
||||
$table->decimal('signup_fee')->default('0.00');
|
||||
$table->string('currency', 3);
|
||||
$table->smallInteger('trial_period')->unsigned()->default(0);
|
||||
$table->string('trial_interval')->default('day');
|
||||
$table->smallInteger('invoice_period')->unsigned()->default(0);
|
||||
$table->string('invoice_interval')->default('month');
|
||||
$table->smallInteger('grace_period')->unsigned()->default(0);
|
||||
$table->string('grace_interval')->default('day');
|
||||
$table->tinyInteger('prorate_day')->unsigned()->nullable();
|
||||
$table->tinyInteger('prorate_period')->unsigned()->nullable();
|
||||
$table->tinyInteger('prorate_extend_due')->unsigned()->nullable();
|
||||
$table->smallInteger('active_subscribers_limit')->unsigned()->nullable();
|
||||
$table->mediumInteger('sort_order')->unsigned()->default(0);
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// Indexes
|
||||
$table->unique('slug');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists(config('rinvex.subscriptions.tables.plans'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get jsonable column data type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function jsonable(): string
|
||||
{
|
||||
$driverName = DB::connection()->getPdo()->getAttribute(PDO::ATTR_DRIVER_NAME);
|
||||
$dbVersion = DB::connection()->getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION);
|
||||
$isOldVersion = version_compare($dbVersion, '5.7.8', 'lt');
|
||||
|
||||
return $driverName === 'mysql' && $isOldVersion ? 'text' : 'json';
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePlanFeaturesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create(config('rinvex.subscriptions.tables.plan_features'), function (Blueprint $table) {
|
||||
// Columns
|
||||
$table->increments('id');
|
||||
$table->integer('plan_id')->unsigned();
|
||||
$table->string('slug');
|
||||
$table->{$this->jsonable()}('name');
|
||||
$table->{$this->jsonable()}('description')->nullable();
|
||||
$table->string('value');
|
||||
$table->smallInteger('resettable_period')->unsigned()->default(0);
|
||||
$table->string('resettable_interval')->default('month');
|
||||
$table->mediumInteger('sort_order')->unsigned()->default(0);
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// Indexes
|
||||
$table->unique(['plan_id', 'slug']);
|
||||
$table->foreign('plan_id')->references('id')->on(config('rinvex.subscriptions.tables.plans'))
|
||||
->onDelete('cascade')->onUpdate('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists(config('rinvex.subscriptions.tables.plan_features'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get jsonable column data type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function jsonable(): string
|
||||
{
|
||||
$driverName = DB::connection()->getPdo()->getAttribute(PDO::ATTR_DRIVER_NAME);
|
||||
$dbVersion = DB::connection()->getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION);
|
||||
$isOldVersion = version_compare($dbVersion, '5.7.8', 'lt');
|
||||
|
||||
return $driverName === 'mysql' && $isOldVersion ? 'text' : 'json';
|
||||
}
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePlanSubscriptionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create(config('rinvex.subscriptions.tables.plan_subscriptions'), function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->morphs('user');
|
||||
$table->integer('plan_id')->unsigned();
|
||||
$table->string('slug');
|
||||
$table->{$this->jsonable()}('name');
|
||||
$table->{$this->jsonable()}('description')->nullable();
|
||||
$table->dateTime('trial_ends_at')->nullable();
|
||||
$table->dateTime('starts_at')->nullable();
|
||||
$table->dateTime('ends_at')->nullable();
|
||||
$table->dateTime('cancels_at')->nullable();
|
||||
$table->dateTime('canceled_at')->nullable();
|
||||
$table->string('timezone')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// Indexes
|
||||
$table->unique('slug');
|
||||
$table->foreign('plan_id')->references('id')->on(config('rinvex.subscriptions.tables.plans'))
|
||||
->onDelete('cascade')->onUpdate('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists(config('rinvex.subscriptions.tables.plan_subscriptions'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get jsonable column data type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function jsonable(): string
|
||||
{
|
||||
$driverName = DB::connection()->getPdo()->getAttribute(PDO::ATTR_DRIVER_NAME);
|
||||
$dbVersion = DB::connection()->getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION);
|
||||
$isOldVersion = version_compare($dbVersion, '5.7.8', 'lt');
|
||||
|
||||
return $driverName === 'mysql' && $isOldVersion ? 'text' : 'json';
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePlanSubscriptionUsageTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create(config('rinvex.subscriptions.tables.plan_subscription_usage'), function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('subscription_id')->unsigned();
|
||||
$table->integer('feature_id')->unsigned();
|
||||
$table->smallInteger('used')->unsigned();
|
||||
$table->dateTime('valid_until')->nullable();
|
||||
$table->string('timezone')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->unique(['subscription_id', 'feature_id']);
|
||||
$table->foreign('subscription_id')->references('id')->on(config('rinvex.subscriptions.tables.plan_subscriptions'))
|
||||
->onDelete('cascade')->onUpdate('cascade');
|
||||
$table->foreign('feature_id')->references('id')->on(config('rinvex.subscriptions.tables.plan_features'))
|
||||
->onDelete('cascade')->onUpdate('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists(config('rinvex.subscriptions.tables.plan_subscription_usage'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user