55
common/Database/migrations/2014_10_12_000000_create_users_table.php
Executable file
55
common/Database/migrations/2014_10_12_000000_create_users_table.php
Executable file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasTable('users')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('username', 100)->nullable();
|
||||
$table->string('first_name', 100)->nullable();
|
||||
$table->string('last_name', 100)->nullable();
|
||||
$table->string('avatar_url')->nullable();
|
||||
$table->string('gender', 20)->nullable();
|
||||
$table->text('permissions')->nullable();
|
||||
$table->string('email')->unique();
|
||||
$table->string('password', 60);
|
||||
$table->string('card_brand', 30)->nullable();
|
||||
$table->string('card_last_four', 4)->nullable();
|
||||
$table->rememberToken();
|
||||
$table
|
||||
->timestamp('created_at')
|
||||
->index()
|
||||
->nullable();
|
||||
$table
|
||||
->timestamp('updated_at')
|
||||
->index()
|
||||
->nullable();
|
||||
|
||||
$table->collation = config('database.connections.mysql.collation');
|
||||
$table->charset = config('database.connections.mysql.charset');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('users');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePasswordResetsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasTable('password_resets')) return;
|
||||
|
||||
Schema::create('password_resets', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('email')->index();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
|
||||
$table->collation = config('database.connections.mysql.collation');
|
||||
$table->charset = config('database.connections.mysql.charset');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('password_resets');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateSocialProfilesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasTable('social_profiles')) return;
|
||||
|
||||
Schema::create('social_profiles', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->integer('user_id');
|
||||
$table->string('service_name', 20);
|
||||
$table->string('user_service_id');
|
||||
$table->string('username')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index('user_id');
|
||||
$table->unique(['user_id', 'service_name']);
|
||||
$table->unique(['service_name', 'user_service_id']);
|
||||
|
||||
$table->collation = config('database.connections.mysql.collation');
|
||||
$table->charset = config('database.connections.mysql.charset');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('social_profiles');
|
||||
}
|
||||
|
||||
}
|
||||
39
common/Database/migrations/2015_05_29_131549_create_settings_table.php
Executable file
39
common/Database/migrations/2015_05_29_131549_create_settings_table.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateSettingsTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasTable('settings')) return;
|
||||
|
||||
Schema::create('settings', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->string('name')->unique();
|
||||
$table->text('value');
|
||||
$table->timestamps();
|
||||
|
||||
$table->collation = config('database.connections.mysql.collation');
|
||||
$table->charset = config('database.connections.mysql.charset');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('settings');
|
||||
}
|
||||
|
||||
}
|
||||
41
common/Database/migrations/2015_10_23_164355_create_follows_table.php
Executable file
41
common/Database/migrations/2015_10_23_164355_create_follows_table.php
Executable file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateFollowsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasTable('follows')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::create('follows', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('follower_id');
|
||||
$table->integer('followed_id');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['follower_id', 'followed_id']);
|
||||
|
||||
$table->collation = config('database.connections.mysql.collation');
|
||||
$table->charset = config('database.connections.mysql.charset');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('follows');
|
||||
}
|
||||
}
|
||||
39
common/Database/migrations/2016_05_12_190852_create_tags_table.php
Executable file
39
common/Database/migrations/2016_05_12_190852_create_tags_table.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateTagsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasTable('tags')) return;
|
||||
|
||||
Schema::create('tags', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name')->index()->unique();
|
||||
$table->string('display_name')->nullable();
|
||||
$table->string('type', 30)->index()->default('custom');
|
||||
$table->timestamp('created_at')->index()->nullable();
|
||||
$table->timestamp('updated_at')->index()->nullable();
|
||||
|
||||
$table->collation = config('database.connections.mysql.collation');
|
||||
$table->charset = config('database.connections.mysql.charset');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('tags');
|
||||
}
|
||||
}
|
||||
38
common/Database/migrations/2016_05_12_190958_create_taggables_table.php
Executable file
38
common/Database/migrations/2016_05_12_190958_create_taggables_table.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateTaggablesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('taggables', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('tag_id')->unsigned()->index();
|
||||
$table->integer('taggable_id')->unsigned()->index();
|
||||
$table->string('taggable_type', 80)->index();
|
||||
$table->integer('user_id')->unsigned()->index()->nullable();
|
||||
|
||||
$table->unique(['tag_id', 'taggable_id', 'user_id', 'taggable_type'], 'taggable_unique');
|
||||
|
||||
$table->collation = config('database.connections.mysql.collation');
|
||||
$table->charset = config('database.connections.mysql.charset');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('taggables');
|
||||
}
|
||||
}
|
||||
31
common/Database/migrations/2016_05_26_170044_create_uploads_table.php
Executable file
31
common/Database/migrations/2016_05_26_170044_create_uploads_table.php
Executable file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateUploadsTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('uploads', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name')->index();
|
||||
$table->string('file_name', 36)->unique();
|
||||
$table->string('file_size');
|
||||
$table->string('mime');
|
||||
$table->string('extension');
|
||||
$table->string('user_id')->index();
|
||||
$table->string('url')->nullable();
|
||||
$table->string('thumbnail_url')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->collation = config('database.connections.mysql.collation');
|
||||
$table->charset = config('database.connections.mysql.charset');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('uploads');
|
||||
}
|
||||
}
|
||||
34
common/Database/migrations/2016_05_27_143158_create_uploadables_table.php
Executable file
34
common/Database/migrations/2016_05_27_143158_create_uploadables_table.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateUploadablesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('uploadables', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->unsignedInteger('upload_id');
|
||||
$table->unsignedInteger('uploadable_id');
|
||||
$table->string('uploadable_type', 60);
|
||||
|
||||
$table->unique(['upload_id', 'uploadable_id', 'uploadable_type'], 'uploadable_unique');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('uploadables');
|
||||
}
|
||||
}
|
||||
39
common/Database/migrations/2016_07_14_153703_create_groups_table.php
Executable file
39
common/Database/migrations/2016_07_14_153703_create_groups_table.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateGroupsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasTable('groups')) return;
|
||||
|
||||
Schema::create('groups', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name')->unique();
|
||||
$table->text('permissions')->nullable();
|
||||
$table->boolean('default')->default(0)->unsigned()->index();
|
||||
$table->boolean('guests')->default(0)->unsigned()->index();
|
||||
$table->timestamps();
|
||||
|
||||
$table->collation = config('database.connections.mysql.collation');
|
||||
$table->charset = config('database.connections.mysql.charset');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('groups');
|
||||
}
|
||||
}
|
||||
37
common/Database/migrations/2016_07_14_153921_create_user_group_table.php
Executable file
37
common/Database/migrations/2016_07_14_153921_create_user_group_table.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateUserGroupTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('user_group', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('user_id');
|
||||
$table->integer('group_id');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
|
||||
$table->unique(['user_id', 'group_id']);
|
||||
|
||||
$table->collation = config('database.connections.mysql.collation');
|
||||
$table->charset = config('database.connections.mysql.charset');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('user_group');
|
||||
}
|
||||
}
|
||||
38
common/Database/migrations/2017_07_02_120142_create_pages_table.php
Executable file
38
common/Database/migrations/2017_07_02_120142_create_pages_table.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePagesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasTable('pages')) return;
|
||||
|
||||
Schema::create('pages', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->longText('body');
|
||||
$table->string('slug')->unique()->index();
|
||||
$table->timestamps();
|
||||
|
||||
$table->collation = config('database.connections.mysql.collation');
|
||||
$table->charset = config('database.connections.mysql.charset');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('pages');
|
||||
}
|
||||
}
|
||||
35
common/Database/migrations/2017_07_11_122825_create_localizations_table.php
Executable file
35
common/Database/migrations/2017_07_11_122825_create_localizations_table.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateLocalizationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('localizations', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name')->index();
|
||||
$table->timestamps();
|
||||
|
||||
$table->collation = config('database.connections.mysql.collation');
|
||||
$table->charset = config('database.connections.mysql.charset');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('localizations');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddPrivateFieldToSettingsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasColumn('settings', 'private')) return;
|
||||
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->boolean('private')->default(0)->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->dropColumn('private');
|
||||
});
|
||||
}
|
||||
}
|
||||
28
common/Database/migrations/2017_09_17_144728_add_columns_to_users_table.php
Executable file
28
common/Database/migrations/2017_09_17_144728_add_columns_to_users_table.php
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddColumnsToUsersTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasColumn('users', 'language')) return;
|
||||
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('language', 6)->nullable();
|
||||
$table->string('country', 40)->nullable();
|
||||
$table->string('timezone', 30)->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('language');
|
||||
$table->dropColumn('country');
|
||||
$table->dropColumn('timezone');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class MakePasswordColumnNullable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('password', 60)->nullable()->change();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('password', 60)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class MakeSettingsValueColumnNullable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->text('value')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
$table->text('value')->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddPublicColumnToUploadsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('uploads', function (Blueprint $table) {
|
||||
$table->boolean('public')->default(0)->index();
|
||||
|
||||
// set collation to latin1_bin for maximum encoded string length
|
||||
$pathColumn = $table->string('path')->nullable();
|
||||
$pathColumn->collation = 'latin1_bin';
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('uploads', function (Blueprint $table) {
|
||||
$table->dropColumn('public');
|
||||
$table->dropColumn('path');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddAvatarColumnToUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasColumn('users', 'avatar')) return;
|
||||
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('avatar')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->removeColumn('avatar');
|
||||
});
|
||||
}
|
||||
}
|
||||
39
common/Database/migrations/2018_01_10_140732_create_subscriptions_table.php
Executable file
39
common/Database/migrations/2018_01_10_140732_create_subscriptions_table.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateSubscriptionsTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('subscriptions', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->integer('user_id')->index();
|
||||
$table->string('plan_id')->index();
|
||||
$table
|
||||
->string('gateway')
|
||||
->default('none')
|
||||
->index();
|
||||
$table
|
||||
->string('gateway_id')
|
||||
->nullable()
|
||||
->unique()
|
||||
->index();
|
||||
$table->integer('quantity')->default(1);
|
||||
$table->text('description')->nullable();
|
||||
$table->timestamp('trial_ends_at')->nullable();
|
||||
$table->timestamp('ends_at')->nullable();
|
||||
$table->timestamp('renews_at')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->collation = config('database.connections.mysql.collation');
|
||||
$table->charset = config('database.connections.mysql.charset');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('subscriptions');
|
||||
}
|
||||
}
|
||||
34
common/Database/migrations/2018_01_10_140746_add_billing_to_users_table.php
Executable file
34
common/Database/migrations/2018_01_10_140746_add_billing_to_users_table.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddBillingToUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasColumn('users', 'stripe_id')) return;
|
||||
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('stripe_id')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('stripe_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
48
common/Database/migrations/2018_01_10_161706_create_billing_plans_table.php
Executable file
48
common/Database/migrations/2018_01_10_161706_create_billing_plans_table.php
Executable file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateBillingPlansTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('billing_plans', function(Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->integer('amount')->nullable();
|
||||
$table->string('currency');
|
||||
$table->string('currency_symbol')->default('$');
|
||||
$table->string('interval')->default('month');
|
||||
$table->integer('interval_count')->default(1);
|
||||
$table->integer('parent_id')->nullable();
|
||||
$table->text('permissions')->nullable();
|
||||
$table->uuid('uuid');
|
||||
$table->boolean('recommended')->default(0);
|
||||
$table->boolean('free')->default(0);
|
||||
$table->boolean('show_permissions')->default(0);
|
||||
$table->text('features')->nullable();
|
||||
$table->integer('position')->default(0);
|
||||
$table->timestamps();
|
||||
|
||||
$table->collation = config('database.connections.mysql.collation');
|
||||
$table->charset = config('database.connections.mysql.charset');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('billing_plans');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddAvailableSpaceToBillingPlansTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('billing_plans', function (Blueprint $table) {
|
||||
$table->bigInteger('available_space')->nullable()->unsigned();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('billing_plans', function (Blueprint $table) {
|
||||
$table->dropColumn('available_space');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddAvailableSpaceToUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasColumn('users', 'available_space')) return;
|
||||
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->bigInteger('available_space')->nullable()->unsigned();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
if ( ! Schema::hasColumn('users', 'available_space')) return;
|
||||
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('available_space');
|
||||
});
|
||||
}
|
||||
}
|
||||
44
common/Database/migrations/2018_07_26_142339_rename_groups_to_roles.php
Executable file
44
common/Database/migrations/2018_07_26_142339_rename_groups_to_roles.php
Executable file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RenameGroupsToRoles extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if ( ! Schema::hasTable('roles')) {
|
||||
Schema::table('groups', function (Blueprint $table) {
|
||||
$table->rename('roles');
|
||||
});
|
||||
}
|
||||
|
||||
if ( ! Schema::hasTable('user_role')) {
|
||||
Schema::table('user_group', function (Blueprint $table) {
|
||||
$table->rename('user_role');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('roles', function (Blueprint $table) {
|
||||
$table->rename('groups');
|
||||
});
|
||||
|
||||
Schema::table('user_role', function (Blueprint $table) {
|
||||
$table->rename('user_group');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RenameUserRoleTableColumnsToRoles extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('user_role', function (Blueprint $table) {
|
||||
$table->renameColumn('group_id', 'role_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('user_role', function (Blueprint $table) {
|
||||
$table->renameColumn('role_id', 'group_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RenameUploadsToFileEntries extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasTable('file_entries')) return;
|
||||
|
||||
Schema::table('uploads', function (Blueprint $table) {
|
||||
$table->rename('file_entries');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('file_entries', function (Blueprint $table) {
|
||||
$table->rename('uploads');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RefactorFileEntriesColumns extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
// refactoring was already done via another (app specific) migration
|
||||
if (Schema::hasColumn('file_entries', 'public_path')) return;
|
||||
|
||||
Schema::table('file_entries', function (Blueprint $table) {
|
||||
$table->bigInteger('file_size')->unsigned()->nullable()->change();
|
||||
$table->integer('parent_id')->nullable()->index();
|
||||
$table->string('description', 150)->nullable();
|
||||
$table->string('mime', 100)->nullable()->change();
|
||||
$table->string('extension', 10)->nullable()->change();
|
||||
$table->string('password', 50)->nullable();
|
||||
$table->string('type', 20)->nullable()->index();
|
||||
$table->timestamp('deleted_at')->nullable()->index();
|
||||
$table->dropColumn('url');
|
||||
$table->dropColumn('thumbnail_url');
|
||||
$table->renameColumn('path', 'public_path');
|
||||
$table->string('user_id')->index()->nullable()->change();
|
||||
|
||||
$table->index('updated_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('file_entries', function (Blueprint $table) {
|
||||
$table->dropColumn('parent_id');
|
||||
$table->dropColumn('description');
|
||||
$table->dropColumn('password');
|
||||
$table->dropColumn('deleted_at');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddFolderPathColumnToFileEntriesTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasColumn('file_entries', 'path')) return;
|
||||
|
||||
Schema::table('file_entries', function (Blueprint $table) {
|
||||
$table->string('path')->nullable()->index();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('file_entries', function (Blueprint $table) {
|
||||
$table->dropColumn('path');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Common\Files\FileEntry;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class MigrateFileEntryUsersToManyToMany extends Migration
|
||||
{
|
||||
/**
|
||||
* migrate file entries => user from "one to one" to "many to many"
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if ( ! Schema::hasTable('user_file_entry')) {
|
||||
return;
|
||||
}
|
||||
|
||||
FileEntry::select('id', 'user_id')->orderBy('id')->chunk(50, function(Collection $entries) {
|
||||
$records = $entries->map(function(FileEntry $entry) {
|
||||
return ['file_entry_id' => $entry->id, 'user_id' => $entry->user_id, 'owner' => 1];
|
||||
});
|
||||
|
||||
DB::table('user_file_entry')->insert($records->toArray());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class MoveUploadsIntoSubfolders extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$drive = Storage::drive(config('common.site.uploads_disk'));
|
||||
|
||||
foreach ($drive->files() as $fileName) {
|
||||
$pathinfo = pathinfo($fileName);
|
||||
if ( ! isset($pathinfo['extension']) && ! \Str::contains($fileName, '.')) {
|
||||
$drive->createDir("$fileName-temp");
|
||||
$drive->move($fileName, "$fileName-temp/$fileName");
|
||||
$drive->rename("$fileName-temp", $fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
28
common/Database/migrations/2018_08_31_104145_rename_uploadables_table.php
Executable file
28
common/Database/migrations/2018_08_31_104145_rename_uploadables_table.php
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RenameUploadablesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::rename('uploadables', 'file_entry_models');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::rename('file_entry_models', 'uploadables');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RenameFileEntryModelsTableColumns extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('file_entry_models', function (Blueprint $table) {
|
||||
$table->renameColumn('upload_id', 'file_entry_id');
|
||||
$table->renameColumn('uploadable_id', 'model_id');
|
||||
$table->renameColumn('uploadable_type', 'model_type');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('file_entry_models', function (Blueprint $table) {
|
||||
$table->renameColumn('file_entry_id', 'upload_id');
|
||||
$table->renameColumn('model_id', 'uploadable_id');
|
||||
$table->renameColumn('model_type', 'uploadable_type');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddTypeAndTitleColumnsToPagesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('pages', function (Blueprint $table) {
|
||||
if ( ! Schema::hasColumn('pages', 'type')) {
|
||||
$table->string('type', 20)->index()->default('default')->after('slug');
|
||||
}
|
||||
|
||||
if ( ! Schema::hasColumn('pages', 'title')) {
|
||||
$table->string('title')->nullable()->after('id');
|
||||
} else {
|
||||
$table->string('title')->nullable()->change();
|
||||
}
|
||||
|
||||
$table->text('meta')->nullable()->after('slug');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('pages', function (Blueprint $table) {
|
||||
$table->dropColumn('type');
|
||||
$table->dropColumn('title');
|
||||
$table->dropColumn('meta');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ChangeUniqueIndexOnTagsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tags', function (Blueprint $table) {
|
||||
$table->string('type', 30)->default('custom')->change();
|
||||
|
||||
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$indexesFound = $sm->listTableIndexes('tags');
|
||||
|
||||
if (array_key_exists('tags_name_unique', $indexesFound)) {
|
||||
$table->dropUnique('tags_name_unique');
|
||||
}
|
||||
|
||||
if (array_key_exists('tags_name_type_unique', $indexesFound)) {
|
||||
$table->dropUnique('tags_name_type_unique');
|
||||
}
|
||||
|
||||
$table->unique(['name', 'type']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
28
common/Database/migrations/2019_02_16_150049_delete_old_seo_settings.php
Executable file
28
common/Database/migrations/2019_02_16_150049_delete_old_seo_settings.php
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class DeleteOldSeoSettings extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
DB::table('settings')->where('name', 'LIKE', 'seo.%')->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
38
common/Database/migrations/2019_02_24_141457_create_jobs_table.php
Executable file
38
common/Database/migrations/2019_02_24_141457_create_jobs_table.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateJobsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('queue');
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
|
||||
$table->index(['queue', 'reserved_at']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddPreviewTokenToFileEntriesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('file_entries', function (Blueprint $table) {
|
||||
$table->string('preview_token', 15)->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('file_entries', function (Blueprint $table) {
|
||||
$table->dropColumn('preview_token');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddThumbnailColumnToFileEntriesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('file_entries', function (Blueprint $table) {
|
||||
$table->boolean('thumbnail')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('file_entries', function (Blueprint $table) {
|
||||
$table->dropColumn('thumbnail');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddPaypalIdColumnToBillingPlansTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('billing_plans', function (Blueprint $table) {
|
||||
$table->string('paypal_id', 50)->nullable()->after('uuid');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('billing_plans', function (Blueprint $table) {
|
||||
$table->dropColumn('paypal_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class IndexDescriptionColumnInFileEntriesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('file_entries', function (Blueprint $table) {
|
||||
$table->index('description');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('file_entries', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
36
common/Database/migrations/2019_06_08_120504_create_custom_domains_table.php
Executable file
36
common/Database/migrations/2019_06_08_120504_create_custom_domains_table.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCustomDomainsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasTable('custom_domains')) return;
|
||||
|
||||
Schema::create('custom_domains', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('host', 100)->index()->unique();
|
||||
$table->integer('user_id')->index();
|
||||
$table->timestamp('created_at')->index()->nullable();
|
||||
$table->timestamp('updated_at')->index()->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('custom_domains');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddUserIdColumnToPagesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('pages', function (Blueprint $table) {
|
||||
$table->integer('user_id')->nullable()->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('pages', function (Blueprint $table) {
|
||||
$table->dropColumn('user_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RenamePagesTableToCustomPages extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if ( ! Schema::hasTable('custom_pages')) {
|
||||
Schema::table('pages', function (Blueprint $table) {
|
||||
$table->rename('custom_pages');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
if ( ! Schema::hasTable('pages')) {
|
||||
Schema::table('custom_pages', function (Blueprint $table) {
|
||||
$table->rename('pages');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
38
common/Database/migrations/2019_06_18_133933_create_permissions_table.php
Executable file
38
common/Database/migrations/2019_06_18_133933_create_permissions_table.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePermissionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasTable('permissions')) return;
|
||||
|
||||
Schema::create('permissions', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name', 30)->unique();
|
||||
$table->string('display_name');
|
||||
$table->text('description')->nullable();
|
||||
$table->string('group', 30);
|
||||
$table->text('restrictions')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('permissions');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePermissionablesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasTable('permissionables')) return;
|
||||
|
||||
Schema::create('permissionables', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('permission_id')->index();
|
||||
$table->integer('permissionable_id')->index();
|
||||
$table->string('permissionable_type', 40)->index();
|
||||
$table->text('restrictions')->nullable();
|
||||
|
||||
$table->unique(['permission_id', 'permissionable_id', 'permissionable_type'], 'permissionable_unique');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('permissionables');
|
||||
}
|
||||
}
|
||||
41
common/Database/migrations/2019_06_18_135822_rename_permissions_columns.php
Executable file
41
common/Database/migrations/2019_06_18_135822_rename_permissions_columns.php
Executable file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RenamePermissionsColumns extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$tables = ['users', 'roles', 'billing_plans'];
|
||||
|
||||
foreach ($tables as $tableName) {
|
||||
// rename permissions column
|
||||
if (Schema::hasColumn($tableName, 'permissions')) {
|
||||
Schema::table($tableName, function (Blueprint $table) {
|
||||
$table->renameColumn('permissions', 'legacy_permissions');
|
||||
});
|
||||
}
|
||||
|
||||
// drop permissions index, if exists
|
||||
Schema::table($tableName, function (Blueprint $table) use($tableName) {
|
||||
$sm = Schema::getConnection()->getDoctrineSchemaManager();
|
||||
$indexesFound = $sm->listTableIndexes($tableName);
|
||||
|
||||
if (array_key_exists('legacy_permissions', $indexesFound)) {
|
||||
$table->dropIndex('legacy_permissions');
|
||||
}
|
||||
|
||||
if (array_key_exists('permissions', $indexesFound)) {
|
||||
$table->dropIndex('permissions');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
39
common/Database/migrations/2019_07_08_122001_create_css_themes_table.php
Executable file
39
common/Database/migrations/2019_07_08_122001_create_css_themes_table.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCssThemesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasTable('css_themes')) return;
|
||||
|
||||
Schema::create('css_themes', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name', 100)->unique();
|
||||
$table->boolean('is_dark')->default(0);
|
||||
$table->boolean('default_light')->index()->default(0);
|
||||
$table->boolean('default_dark')->index()->default(0);
|
||||
$table->integer('user_id')->index();
|
||||
$table->text('colors');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('css_themes');
|
||||
}
|
||||
}
|
||||
37
common/Database/migrations/2019_07_20_141752_create_invoices_table.php
Executable file
37
common/Database/migrations/2019_07_20_141752_create_invoices_table.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateInvoicesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasTable('invoices')) return;
|
||||
|
||||
Schema::create('invoices', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('subscription_id')->index();
|
||||
$table->boolean('paid');
|
||||
$table->string('uuid', 10)->index();
|
||||
$table->text('notes')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('invoices');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddGlobalColumnToCustomDomainsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasColumn('custom_domains', 'global')) return;
|
||||
Schema::table('custom_domains', function (Blueprint $table) {
|
||||
$table->boolean('global')->index()->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('custom_domains', function (Blueprint $table) {
|
||||
$table->dropColumn('global');
|
||||
});
|
||||
}
|
||||
}
|
||||
33
common/Database/migrations/2019_09_13_141123_change_plan_amount_to_float.php
Executable file
33
common/Database/migrations/2019_09_13_141123_change_plan_amount_to_float.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ChangePlanAmountToFloat extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('billing_plans', function(Blueprint $table) {
|
||||
$prefix = DB::getTablePrefix();
|
||||
DB::statement("ALTER TABLE {$prefix}billing_plans CHANGE amount amount DECIMAL(13,2) NULL");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('billing_plans', function (Blueprint $table) {
|
||||
$table->integer('amount')->nullable()->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddIndexToUsernameColumn extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->index('username');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropIndex('username');
|
||||
});
|
||||
}
|
||||
}
|
||||
39
common/Database/migrations/2019_10_20_143522_create_comments_table.php
Executable file
39
common/Database/migrations/2019_10_20_143522_create_comments_table.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCommentsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasTable('comments')) return;
|
||||
|
||||
Schema::create('comments', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->text('content');
|
||||
$table->integer('parent_id')->unsigned()->nullable()->index();
|
||||
$table->string('path')->index();
|
||||
$table->integer('user_id')->unsigned()->index();
|
||||
$table->integer('commentable_id')->unsigned()->index();
|
||||
$table->string('commentable_type', 30)->index();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('comments');
|
||||
}
|
||||
}
|
||||
37
common/Database/migrations/2019_10_23_134520_create_notifications_table.php
Executable file
37
common/Database/migrations/2019_10_23_134520_create_notifications_table.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateNotificationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasTable('notifications')) return;
|
||||
|
||||
Schema::create('notifications', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('type');
|
||||
$table->morphs('notifiable');
|
||||
$table->text('data');
|
||||
$table->timestamp('read_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('notifications');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddResourceIdAndTypeToCustomDomainsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('custom_domains', function (Blueprint $table) {
|
||||
$table->integer('resource_id')->unsigned()->index()->nullable();
|
||||
$table->string('resource_type', 20)->index()->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('custom_domains', function (Blueprint $table) {
|
||||
$table->dropColumn('resource_id');
|
||||
$table->dropColumn('resource_type');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePersonalAccessTokensTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasTable('personal_access_tokens')) return;
|
||||
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->morphs('tokenable');
|
||||
$table->string('name');
|
||||
$table->string('token', 64)->unique();
|
||||
$table->text('abilities')->nullable();
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('personal_access_tokens');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RenamePublicPathColumnToDiskPrefix extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('file_entries', function (Blueprint $table) {
|
||||
$prefix = DB::getTablePrefix();
|
||||
DB::statement("ALTER TABLE {$prefix}file_entries CHANGE public_path disk_prefix VARCHAR(191) NULL");
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('file_entries', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class ChangeFileSizeColumnDefaultValueTo0 extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('file_entries', function (Blueprint $table) {
|
||||
$table->bigInteger('file_size')->unsigned()->default(0)->notNull()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('file_entries', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class UpdateFileEntryModelsTableToV2 extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('file_entry_models', function (Blueprint $table) {
|
||||
$table->timestamps();
|
||||
$table->boolean('owner')->default(0)->index();
|
||||
$table->text('permissions')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class MoveUserFileEntryTableRecordsToFileEntryModels extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if ( ! Schema::hasTable('user_file_entry')) {
|
||||
return;
|
||||
}
|
||||
|
||||
DB::table('user_file_entry')
|
||||
->chunkById(100, function(Collection $records) {
|
||||
$records = $records->map(function($record) {
|
||||
$record = (array) $record;
|
||||
$record['model_type'] = User::class;
|
||||
$record['model_id'] = $record['user_id'];
|
||||
unset($record['user_id']);
|
||||
return $record;
|
||||
});
|
||||
try {
|
||||
DB::table('file_entry_models')->insert($records->toArray());
|
||||
} catch (Exception $e) {
|
||||
//
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateNotificationSubscriptionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasTable('notification_subscriptions')) return;
|
||||
|
||||
Schema::create('notification_subscriptions', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('notif_id', 5)->index();
|
||||
$table->integer('user_id')->index();
|
||||
$table->string('channels');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('notification_subscriptions');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddLanguageColToLocalizationsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('localizations', function (Blueprint $table) {
|
||||
$table->string('language', 5)->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('localizations', function (Blueprint $table) {
|
||||
$table->dropColumn('language');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Common\Core\Values\ValueLists;
|
||||
use Common\Localizations\Localization;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class AddLangCodeToExistingLocalizations extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$languages = app(ValueLists::class)->languages();
|
||||
|
||||
app(Localization::class)->get()->each(function(Localization $localization) use($languages) {
|
||||
if ( ! $localization->language) {
|
||||
$lang = Arr::first($languages, function($lang) use($localization) {
|
||||
return slugify($lang['name']) === slugify($localization->name);
|
||||
});
|
||||
if ( ! $lang) {
|
||||
$lang = Arr::random($languages);
|
||||
}
|
||||
$localization->language = $lang['code'];
|
||||
$localization->save();
|
||||
}
|
||||
|
||||
$slugName = slugify($localization->name);
|
||||
$oldPath = resource_path("lang/$slugName.json");
|
||||
|
||||
if (file_exists($oldPath)) {
|
||||
rename($oldPath, resource_path("lang/$localization->language.json"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddHiddenColumnToPlansTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('billing_plans', function (Blueprint $table) {
|
||||
$table->boolean('hidden')->default(false)->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('billing_plans', function (Blueprint $table) {
|
||||
$table->dropColumn('hidden');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class AddVerifiedAtColumnToUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if ( !Schema::hasColumn('users', 'email_verified_at')) {
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('email_verified_at');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class MoveConfirmedColumnToEmailVerifiedAt extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasColumn('users', 'confirmed')) {
|
||||
User::where('confirmed', true)
|
||||
->update(['email_verified_at' => Carbon::now()]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class FixIssuesWithMigrationToLaravel7 extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
try {
|
||||
collect(File::allFiles(resource_path('views/vendor')))
|
||||
->filter(function(SplFileInfo $file) {
|
||||
return Str::endsWith($file->getPathname(), 'blade.php') &&
|
||||
!Str::endsWith($file->getPathname(), 'html/message.blade.php') &&
|
||||
!Str::endsWith($file->getPathname(), 'email.blade.php');
|
||||
})->each(function(SplFileInfo $file) {
|
||||
File::delete($file->getPathname());
|
||||
});
|
||||
} catch (Exception $e) {
|
||||
//
|
||||
}
|
||||
|
||||
try {
|
||||
File::delete(base_path('vendor/symfony/translation/TranslatorInterface.php'));
|
||||
} catch (Exception $e) {
|
||||
//
|
||||
}
|
||||
|
||||
try {
|
||||
$setting = DB::table('settings')->where('name', 'player.enable_landing')->first();
|
||||
if ($setting && (bool) $setting->value) {
|
||||
DB::table('settings')->where('name', 'homepage.type')->orWhere('name', 'homepage.value')->delete();
|
||||
DB::table('settings')->insert([
|
||||
['name' => 'homepage.type', 'value' => 'component'],
|
||||
['name' => 'homepage.value', 'value' => 'Landing Page'],
|
||||
]);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
36
common/Database/migrations/2020_07_22_165126_create_workspaces_table.php
Executable file
36
common/Database/migrations/2020_07_22_165126_create_workspaces_table.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateWorkspacesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if ( ! Schema::hasTable('workspaces')) {
|
||||
Schema::create('workspaces', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->integer('owner_id')->unsigned()->index();
|
||||
$table->timestamp('created_at')->index()->nullable();
|
||||
$table->timestamp('updated_at')->index()->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('workspaces');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateWorkspaceInvitesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if ( ! Schema::hasTable('workspace_invites')) {
|
||||
Schema::create('workspace_invites', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('avatar', 80)->nullable();
|
||||
$table->integer('workspace_id')->unsigned()->index();
|
||||
$table->integer('user_id')->unsigned()->index()->nullable();
|
||||
$table->string('email', 80)->index();
|
||||
$table->integer('role_id')->unsigned()->index();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('workspace_invites');
|
||||
}
|
||||
}
|
||||
39
common/Database/migrations/2020_07_23_164502_create_workspace_user_table.php
Executable file
39
common/Database/migrations/2020_07_23_164502_create_workspace_user_table.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateWorkspaceUserTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if ( ! Schema::hasTable('workspace_user')) {
|
||||
Schema::create('workspace_user', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('user_id')->unsigned()->index();
|
||||
$table->integer('workspace_id')->unsigned()->index();
|
||||
$table->integer('role_id')->unsigned()->index()->nullable();
|
||||
$table->boolean('is_owner')->index()->default(false);
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['workspace_id', 'user_id']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('workspace_user');
|
||||
}
|
||||
}
|
||||
31
common/Database/migrations/2020_07_26_165349_add_columns_to_roles_table.php
Executable file
31
common/Database/migrations/2020_07_26_165349_add_columns_to_roles_table.php
Executable file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddColumnsToRolesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('roles', function (Blueprint $table) {
|
||||
$table->string('description')->nullable();
|
||||
$table->string('type', 20)->default('sitewide');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use const App\Providers\WORKSPACED_RESOURCES;
|
||||
|
||||
class AddWorkspaceIdColumnToWorkspaceableModels extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if ( ! defined('App\Providers\WORKSPACED_RESOURCES')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$models = WORKSPACED_RESOURCES;
|
||||
|
||||
foreach ($models as $model) {
|
||||
$table = app($model)->getTable();
|
||||
if (!Schema::hasColumn($table, 'workspace_id')) {
|
||||
Schema::table($table, function (Blueprint $table) {
|
||||
$table->integer('workspace_id')->unsigned()->nullable()->index();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddTypeColumnToPermissionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('permissions', function (Blueprint $table) {
|
||||
$table->string('type', 20)->default('sitewide');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('permissions', function (Blueprint $table) {
|
||||
$table->dropColumn('type');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddHideNavColumnToCustomPagesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('custom_pages', function (Blueprint $table) {
|
||||
$table->boolean('hide_nav')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('custom_pages', function (Blueprint $table) {
|
||||
$table->dropIndex('hide_nav');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddInternalColummToRolesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('roles', function (Blueprint $table) {
|
||||
$table->boolean('internal')->default(false)->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('roles', function (Blueprint $table) {
|
||||
$table->dropColumn('internal');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddDeletedColumnToCommentsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('comments', function (Blueprint $table) {
|
||||
$table->boolean('deleted')->index()->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddAdvancedColumnToPermissionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('permissions', function (Blueprint $table) {
|
||||
$table->boolean('advanced')->default(false)->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('permissions', function (Blueprint $table) {
|
||||
$table->dropColumn('advanced');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddWorkspaceIdColToCustomDomainsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if ( ! Schema::hasColumn('custom_domains', 'workspace_id')) {
|
||||
Schema::table('custom_domains', function (Blueprint $table) {
|
||||
$table->integer('workspace_id')->unsigned()->nullable()->index();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddWorkspaceIdColToCustomPagesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if ( ! Schema::hasColumn('custom_pages', 'workspace_id')) {
|
||||
Schema::table('custom_pages', function (Blueprint $table) {
|
||||
$table->integer('workspace_id')->unsigned()->nullable()->index();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddWorkspaceIdColToFileEntriesTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
if ( ! Schema::hasColumn('file_entries', 'workspace_id')) {
|
||||
Schema::table('file_entries', function (Blueprint $table) {
|
||||
$table->integer('workspace_id')->unsigned()->nullable()->index();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
36
common/Database/migrations/2021_06_05_182202_create_csv_exports_table.php
Executable file
36
common/Database/migrations/2021_06_05_182202_create_csv_exports_table.php
Executable file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateCsvExportsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (Schema::hasTable('csv_exports')) return;
|
||||
Schema::create('csv_exports', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('cache_name', 50)->unique()->index()->nullable();
|
||||
$table->integer('user_id')->nullable()->index();
|
||||
$table->string('download_name', 50);
|
||||
$table->uuid('uuid');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('csv_exports');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class RenameGatewayColInSubscriptionsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('subscriptions', function (Blueprint $table) {
|
||||
$table->renameColumn('gateway', 'gateway_name');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddOwnerIdColumnToFileEntriesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('file_entries', function (Blueprint $table) {
|
||||
$table->bigInteger('owner_id')->unsigned()->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Common\Files\FileEntry;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class MaterializeOwnerIdInFileEntriesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
FileEntry::with([
|
||||
'users' => function (MorphToMany $builder) {
|
||||
$builder->where('owner', true)->limit(1);
|
||||
},
|
||||
])
|
||||
->lazyById(100)
|
||||
->each(function ($entry) {
|
||||
if ($owner = $entry->users->first()) {
|
||||
$entry->update(['owner_id' => $owner->id]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddCreatedAtColToUserRoleTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if ( ! Schema::hasColumn('user_role', 'created_at')) {
|
||||
Schema::table('user_role', function (Blueprint $table) {
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
40
common/Database/migrations/2021_09_30_123758_slugify_tag_name_column.php
Executable file
40
common/Database/migrations/2021_09_30_123758_slugify_tag_name_column.php
Executable file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Common\Tags\Tag;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class SlugifyTagNameColumn extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Tag::lazyById(100)->each(function (Tag $tag) {
|
||||
$slugName = slugify($tag->name);
|
||||
|
||||
if (!$tag->display_name) {
|
||||
$tag->display_name = $tag->name;
|
||||
}
|
||||
|
||||
if ($slugName !== $tag->name) {
|
||||
$tag->name = $slugName;
|
||||
Tag::where('name', $slugName)->delete();
|
||||
}
|
||||
|
||||
$tag->save();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddTokenColsToSocialProfilesTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('social_profiles', function (Blueprint $table) {
|
||||
$table->string('access_token', 250)->nullable();
|
||||
$table->string('refresh_token', 250)->nullable();
|
||||
$table->timestamp('access_expires_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use const App\Providers\WORKSPACED_RESOURCES;
|
||||
|
||||
class ChangeDefaultWorkspaceIdFromNullToZero extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
if (!defined(WORKSPACED_RESOURCES::class)) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (WORKSPACED_RESOURCES as $resource) {
|
||||
$table = app($resource)->getTable();
|
||||
if (!Schema::hasColumn($table, 'workspace_id')) {
|
||||
Schema::table($table, function (Blueprint $table) {
|
||||
$table
|
||||
->integer('workspace_id')
|
||||
->unsigned()
|
||||
->default(0)
|
||||
->index();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
foreach (WORKSPACED_RESOURCES as $resource) {
|
||||
app($resource)
|
||||
->whereNull('workspace_id')
|
||||
->update(['workspace_id' => 0]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
45
common/Database/migrations/2022_04_23_115027_add_id_to_all_menus.php
Executable file
45
common/Database/migrations/2022_04_23_115027_add_id_to_all_menus.php
Executable file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Common\Settings\Setting;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddIdToAllMenus extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$setting = Setting::where('name', 'menus')->first();
|
||||
if ( ! $setting) return;
|
||||
|
||||
$transformed = collect($setting['value'])->map(
|
||||
function ($menu) {
|
||||
if (!isset($menu['id'])) {
|
||||
$menu['id'] = Str::random('6');
|
||||
}
|
||||
$menu['items'] = array_map(function ($item) {
|
||||
if (!isset($item['id'])) {
|
||||
$item['id'] = Str::random('6');
|
||||
}
|
||||
return $item;
|
||||
}, $menu['items']);
|
||||
return $menu;
|
||||
},
|
||||
);
|
||||
|
||||
Setting::where('name', 'menus')->update(['value' => $transformed]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('subscriptions', function (Blueprint $table) {
|
||||
$table
|
||||
->integer('product_id')
|
||||
->unsigned()
|
||||
->index();
|
||||
|
||||
$table->renameColumn('plan_id', 'price_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
||||
39
common/Database/migrations/2022_08_11_160401_create_prices_table.php
Executable file
39
common/Database/migrations/2022_08_11_160401_create_prices_table.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePricesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('prices', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->decimal('amount', 13, 2);
|
||||
$table->string('currency');
|
||||
$table->string('interval')->default('month');
|
||||
$table->integer('interval_count')->default(1);
|
||||
$table->integer('product_id')->index();
|
||||
$table->string('stripe_id', 50)->nullable();
|
||||
$table->string('paypal_id', 50)->nullable();
|
||||
$table->boolean('default')->default(false);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('prices');
|
||||
}
|
||||
}
|
||||
42
common/Database/migrations/2022_08_11_170041_create_products_table.php
Executable file
42
common/Database/migrations/2022_08_11_170041_create_products_table.php
Executable file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateProductsTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('products', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->text('description')->nullable();
|
||||
$table->uuid();
|
||||
$table->text('feature_list')->nullable();
|
||||
$table
|
||||
->smallInteger('position')
|
||||
->index()
|
||||
->default(0);
|
||||
$table->boolean('recommended')->default(0);
|
||||
$table
|
||||
->boolean('free')
|
||||
->index()
|
||||
->default(0);
|
||||
$table
|
||||
->boolean('hidden')
|
||||
->index()
|
||||
->default(0);
|
||||
$table
|
||||
->bigInteger('available_space')
|
||||
->nullable()
|
||||
->unsigned();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
use Common\Billing\Models\Price;
|
||||
use Common\Billing\Models\Product;
|
||||
use Common\Billing\Subscription;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class MoveBillingPlansToProductsAndPricesTables extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$plans = DB::table('billing_plans')->get();
|
||||
|
||||
$products = [];
|
||||
|
||||
$plans->each(function ($plan) use (&$products) {
|
||||
// convert parent plans to products
|
||||
if (!$plan->parent_id) {
|
||||
$product = Product::create([
|
||||
'name' => $plan->name,
|
||||
'position' => $plan->position,
|
||||
'uuid' => $plan->uuid,
|
||||
'feature_list' => $plan->features
|
||||
? (!is_string($plan->features)
|
||||
? json_encode($plan->features)
|
||||
: $plan->features)
|
||||
: null,
|
||||
'created_at' => $plan->created_at,
|
||||
'updated_at' => $plan->updated_at,
|
||||
'available_space' => $plan->available_space,
|
||||
'free' => $plan->free,
|
||||
'recommended' => $plan->recommended,
|
||||
]);
|
||||
$products[$plan->id] = $product;
|
||||
|
||||
// migrate permissions from plan to newly created product
|
||||
DB::table('permissionables')
|
||||
->where('permissionable_id', $plan->id)
|
||||
->where('permissionable_type', 'Common\Billing\BillingPlan')
|
||||
->update([
|
||||
'permissionable_id' => $product->id,
|
||||
'permissionable_type' => Product::class,
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
// create prices for products from child plans
|
||||
$plans->each(function ($plan) use ($products) {
|
||||
$product = $products[$plan->parent_id ?? $plan->id] ?? null;
|
||||
if (!$product) {
|
||||
return;
|
||||
}
|
||||
|
||||
$productId = $product->id;
|
||||
$price = Price::create([
|
||||
'amount' => $plan->amount ?? 1,
|
||||
'currency' => $plan->currency,
|
||||
'interval' => $plan->interval,
|
||||
'interval_count' => $plan->interval_count,
|
||||
'stripe_id' => $plan->uuid,
|
||||
'paypal_id' => $plan->paypal_id,
|
||||
'created_at' => $plan->created_at,
|
||||
'updated_at' => $plan->updated_at,
|
||||
'default' => !$plan->parent_id,
|
||||
'product_id' => $products[$plan->parent_id ?? $plan->id]->id,
|
||||
]);
|
||||
|
||||
Subscription::where('price_id', $plan->id)->update([
|
||||
'price_id' => $price->id,
|
||||
'product_id' => $productId,
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('card_expires', 10)->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
||||
642
common/Database/migrations/2022_08_24_192127_migrate_common_settings_to_v3.php
Executable file
642
common/Database/migrations/2022_08_24_192127_migrate_common_settings_to_v3.php
Executable file
@@ -0,0 +1,642 @@
|
||||
<?php
|
||||
|
||||
use Common\Admin\Appearance\Themes\CssTheme;
|
||||
use Common\Settings\Setting;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Str;
|
||||
use Spatie\Color\Factory;
|
||||
use Spatie\Color\Hex;
|
||||
|
||||
return new class extends Migration {
|
||||
protected array $svgToPrefix = [
|
||||
'upload.svg',
|
||||
'web-devices.svg',
|
||||
'share.svg',
|
||||
'add-file.svg',
|
||||
'authentication.svg',
|
||||
'right-direction.svg',
|
||||
];
|
||||
|
||||
public function up()
|
||||
{
|
||||
$this->migrateLandingPage();
|
||||
$this->migrateMenus();
|
||||
$this->migrateThemes();
|
||||
$this->migrateAds();
|
||||
$this->migrateGenreImages();
|
||||
$this->migrateLogos();
|
||||
|
||||
Setting::where('name', 'homepage.type')
|
||||
->where('value', 'Channel')
|
||||
->update(['value' => 'channel']);
|
||||
}
|
||||
|
||||
protected function migrateGenreImages()
|
||||
{
|
||||
if (
|
||||
Schema::hasTable('genres') &&
|
||||
Schema::hasColumn('genres', 'image')
|
||||
) {
|
||||
DB::table('genres')->update([
|
||||
'image' => DB::raw(
|
||||
'REPLACE(image, "client/assets/images/", "images/")',
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
protected function migrateLandingPage()
|
||||
{
|
||||
$landing = Setting::where('name', 'landing.appearance')->first();
|
||||
if ($landing) {
|
||||
Setting::insert([
|
||||
'name' => 'homepage.appearance',
|
||||
'value' => $landing['value'],
|
||||
]);
|
||||
Setting::where('name', 'landing.appearance')->delete();
|
||||
}
|
||||
|
||||
$homepage = Setting::where('name', 'homepage.appearance')->first();
|
||||
if (!$homepage) {
|
||||
return;
|
||||
}
|
||||
|
||||
$value = json_encode($homepage['value']);
|
||||
$value = str_replace('client\/assets\/images\/', 'images\/', $value);
|
||||
$value = str_replace('client/assets/images/', 'images/', $value);
|
||||
$value = str_replace('landing-bg.svg', 'landing-bg.jpg', $value);
|
||||
$value = str_replace(
|
||||
'images/landing.jpg',
|
||||
'images/landing/landing.jpg',
|
||||
$value,
|
||||
);
|
||||
$value = str_replace(
|
||||
'headerOverlayColor":',
|
||||
'headerOverlayColor1":',
|
||||
$value,
|
||||
);
|
||||
|
||||
foreach ($this->svgToPrefix as $svg) {
|
||||
$value = str_replace($svg, "images/landing/$svg", $value);
|
||||
}
|
||||
|
||||
// migrate cta actions
|
||||
if (isset($value['actions']['cta1']) && is_string($value['actions']['cta1'])) {
|
||||
$value['actions']['cta1'] = [
|
||||
'type' => 'route',
|
||||
'label' => $value['actions']['cta1'],
|
||||
'action' => '/login'
|
||||
];
|
||||
}
|
||||
if (isset($value['actions']['cta2']) && is_string($value['actions']['cta2'])) {
|
||||
$value['actions']['cta2'] = [
|
||||
'type' => 'link',
|
||||
'label' => $value['actions']['cta2'],
|
||||
'action' => '#secondary-features'
|
||||
];
|
||||
}
|
||||
|
||||
Setting::where('name', 'homepage.appearance')->update([
|
||||
'value' => $value,
|
||||
]);
|
||||
}
|
||||
|
||||
protected function migrateMenus()
|
||||
{
|
||||
$menus = Setting::where('name', 'menus')->first();
|
||||
if (!$menus) {
|
||||
return;
|
||||
}
|
||||
|
||||
$menus = $menus['value'];
|
||||
|
||||
// convert menus "position" string to "positions" array
|
||||
foreach ($menus as $menuKey => $menu) {
|
||||
if (!isset($menu['positions'])) {
|
||||
$menus[$menuKey]['positions'] = [$menu['position']];
|
||||
unset($menus[$menuKey]['position']);
|
||||
}
|
||||
|
||||
foreach ($menu['items'] as $itemKey => $item) {
|
||||
// remove workspaces menu item
|
||||
if (Arr::get($item, 'label') === 'Workspaces') {
|
||||
unset($menus[$menuKey]['items'][$itemKey]);
|
||||
}
|
||||
|
||||
// prefix menu items with slash, if not prefixed already
|
||||
if (
|
||||
$item['type'] === 'route' &&
|
||||
!str_starts_with($item['action'], '/')
|
||||
) {
|
||||
$menus[$menuKey]['items'][$itemKey]['action'] =
|
||||
'/' . $item['action'];
|
||||
}
|
||||
|
||||
if (!isset($item['id'])) {
|
||||
$menus[$menuKey]['items'][$itemKey]['id'] = Str::random(6);
|
||||
}
|
||||
|
||||
if ($item['action'] === '/browse?type=movie') {
|
||||
$menus[$menuKey]['items'][$itemKey]['action'] = '/movies';
|
||||
}
|
||||
|
||||
if ($item['action'] === '/browse?type=series') {
|
||||
$menus[$menuKey]['items'][$itemKey]['action'] = '/series';
|
||||
}
|
||||
|
||||
if ($item['action'] === '/news') {
|
||||
$menus[$menuKey]['items'][$itemKey]['action'] =
|
||||
'/latest-news';
|
||||
}
|
||||
|
||||
if ($item['action'] === '/help-center/tickets') {
|
||||
$menus[$menuKey]['items'][$itemKey]['action'] =
|
||||
'/hc/tickets';
|
||||
$menus[$menuKey]['items'][$itemKey]['roles'] = [2];
|
||||
}
|
||||
|
||||
if ($item['action'] === '/mailbox/tickets') {
|
||||
$menus[$menuKey]['items'][$itemKey]['action'] =
|
||||
'/agent/tickets';
|
||||
$menus[$menuKey]['items'][$itemKey]['roles'] = [3];
|
||||
}
|
||||
|
||||
if (
|
||||
isset($item['label']) &&
|
||||
$item['label'] === 'Agent mailbox'
|
||||
) {
|
||||
$menus[$menuKey]['items'][$itemKey]['action'] =
|
||||
'/agent/tickets';
|
||||
$menus[$menuKey]['items'][$itemKey]['roles'] = [3];
|
||||
}
|
||||
|
||||
if (isset($item['label']) && $item['label'] === 'My tickets') {
|
||||
$menus[$menuKey]['items'][$itemKey]['action'] =
|
||||
'/hc/tickets';
|
||||
$menus[$menuKey]['items'][$itemKey]['roles'] = [2];
|
||||
}
|
||||
|
||||
// migrate icons to svg path config from simple string
|
||||
if (!isset($item['icon'])) {
|
||||
continue;
|
||||
}
|
||||
if ($item['icon'] === 'people') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M9 13.75c-2.34 0-7 1.17-7 3.5V19h14v-1.75c0-2.33-4.66-3.5-7-3.5zM4.34 17c.84-.58 2.87-1.25 4.66-1.25s3.82.67 4.66 1.25H4.34zM9 12c1.93 0 3.5-1.57 3.5-3.5S10.93 5 9 5 5.5 6.57 5.5 8.5 7.07 12 9 12zm0-5c.83 0 1.5.67 1.5 1.5S9.83 10 9 10s-1.5-.67-1.5-1.5S8.17 7 9 7zm7.04 6.81c1.16.84 1.96 1.96 1.96 3.44V19h4v-1.75c0-2.02-3.5-3.17-5.96-3.44zM15 12c1.93 0 3.5-1.57 3.5-3.5S16.93 5 15 5c-.54 0-1.04.13-1.5.35.63.89 1 1.98 1 3.15s-.37 2.26-1 3.15c.46.22.96.35 1.5.35z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'access-time') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.25 2.52.77-1.28-3.52-2.09V8z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'star') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'delete') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'home') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'm12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3 2 12h3v8h6v-6h2v6h6v-8h3L12 3z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'link') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M17 7h-4v2h4c1.65 0 3 1.35 3 3s-1.35 3-3 3h-4v2h4c2.76 0 5-2.24 5-5s-2.24-5-5-5zm-6 8H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-2zm-3-4h8v2H8z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'instagram') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M20 5h-3.2L15 3H9L7.2 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 14h-8v-1c-2.8 0-5-2.2-5-5s2.2-5 5-5V7h8v12zm-3-6c0-2.8-2.2-5-5-5v1.8c1.8 0 3.2 1.4 3.2 3.2s-1.4 3.2-3.2 3.2V18c2.8 0 5-2.2 5-5zm-8.2 0c0 1.8 1.4 3.2 3.2 3.2V9.8c-1.8 0-3.2 1.4-3.2 3.2z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'dashboard') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M19 5v2h-4V5h4M9 5v6H5V5h4m10 8v6h-4v-6h4M9 17v2H5v-2h4M21 3h-8v6h8V3zM11 3H3v10h8V3zm10 8h-8v10h8V11zm-10 4H3v6h8v-6z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'www') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56zM12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zM4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2s.06 1.34.14 2H4.26zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56zm2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8zM12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zM14.34 14H9.66c-.09-.66-.16-1.32-.16-2s.07-1.35.16-2h4.68c.09.65.16 1.32.16 2s-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56zM16.36 14c.08-.66.14-1.32.14-2s-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'tooltip') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M21.99 4c0-1.1-.89-2-1.99-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h14l4 4-.01-18zM20 4v13.17L18.83 16H4V4h16zM6 12h12v2H6zm0-3h12v2H6zm0-3h12v2H6z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'page') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'm22 3-1.67 1.67L18.67 3 17 4.67 15.33 3l-1.66 1.67L12 3l-1.67 1.67L8.67 3 7 4.67 5.33 3 3.67 4.67 2 3v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V3zM11 19H4v-6h7v6zm9 0h-7v-2h7v2zm0-4h-7v-2h7v2zm0-4H4V8h16v3z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'tracking') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M13.02 19.93v2.02c2.01-.2 3.84-1 5.32-2.21l-1.42-1.43c-1.11.86-2.44 1.44-3.9 1.62zM4.03 12c0-4.05 3.03-7.41 6.95-7.93V2.05C5.95 2.58 2.03 6.84 2.03 12c0 5.16 3.92 9.42 8.95 9.95v-2.02c-3.92-.52-6.95-3.88-6.95-7.93zm15.92-1h2.02c-.2-2.01-1-3.84-2.21-5.32l-1.43 1.43c.86 1.1 1.44 2.43 1.62 3.89zm-1.61-6.74c-1.48-1.21-3.32-2.01-5.32-2.21v2.02c1.46.18 2.79.76 3.9 1.62l1.42-1.43zm-.01 12.64 1.43 1.42c1.21-1.48 2.01-3.31 2.21-5.32h-2.02c-.18 1.46-.76 2.79-1.62 3.9z',
|
||||
],
|
||||
],
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M16 11.1C16 8.61 14.1 7 12 7s-4 1.61-4 4.1c0 1.66 1.33 3.63 4 5.9 2.67-2.27 4-4.24 4-5.9zm-4 .9c-.59 0-1.07-.48-1.07-1.07 0-.59.48-1.07 1.07-1.07s1.07.48 1.07 1.07c0 .59-.48 1.07-1.07 1.07z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'facebook') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M19 3H5a2 2 0 00-2 2v14a2 2 0 002 2h7.621v-6.961h-2.343v-2.725h2.343V9.309c0-2.324 1.421-3.591 3.495-3.591.699-.002 1.397.034 2.092.105v2.43H16.78c-1.13 0-1.35.534-1.35 1.322v1.735h2.7l-.351 2.725h-2.365V21H19a2 2 0 002-2V5a2 2 0 00-2-2z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'twitter') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M24 4.3c-.898.4-1.8.7-2.8.802 1-.602 1.8-1.602 2.198-2.704-1 .602-2 1-3.097 1.204C19.3 2.602 18 2 16.6 2a4.907 4.907 0 00-4.9 4.898c0 .403 0 .801.102 1.102C7.7 7.8 4.102 5.898 1.7 2.898c-.5.704-.7 1.602-.7 2.5 0 1.704.898 3.204 2.2 4.102-.802-.102-1.598-.3-2.2-.602V9c0 2.398 1.7 4.398 3.898 4.8-.398.098-.796.2-1.296.2-.301 0-.602 0-.903-.102.602 2 2.403 3.403 4.602 3.403-1.7 1.3-3.801 2.097-6.102 2.097-.398 0-.8 0-1.199-.097C2.2 20.699 4.8 21.5 7.5 21.5c9.102 0 14-7.5 14-14v-.602c1-.699 1.8-1.597 2.5-2.597',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'youtube') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M5.68 2l1.478 5.344v2.562H8.44V7.344L9.937 2h-1.29l-.538 2.432a27.21 27.21 0 00-.29 1.515h-.04c-.063-.42-.159-.93-.29-1.525L6.97 2H5.68zm5.752 2.018c-.434 0-.784.084-1.051.257-.267.172-.464.448-.59.825-.125.377-.187.876-.187 1.498v.84c0 .615.054 1.107.164 1.478.11.371.295.644.556.82.261.176.62.264 1.078.264.446 0 .8-.087 1.06-.26.26-.173.45-.444.565-.818.116-.374.174-.869.174-1.485v-.84c0-.62-.059-1.118-.178-1.492-.119-.373-.308-.648-.566-.824-.258-.176-.598-.263-1.025-.263zm2.447.113v4.314c0 .534.09.927.271 1.178.182.251.465.377.848.377.552 0 .968-.267 1.244-.8h.028l.113.706H17.4V4.131h-1.298v4.588a.635.635 0 01-.23.263.569.569 0 01-.325.104c-.132 0-.226-.054-.283-.164-.057-.11-.086-.295-.086-.553V4.131h-1.3zm-2.477.781c.182 0 .311.095.383.287.072.191.108.495.108.91v1.8c0 .426-.036.735-.108.923-.072.188-.2.282-.38.283-.183 0-.309-.095-.378-.283-.07-.188-.103-.497-.103-.924V6.11c0-.414.035-.718.107-.91.072-.19.195-.287.371-.287zM5 11c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7c0-1.1-.9-2-2-2H5zm7.049 2h1.056v2.568h.008c.095-.186.232-.335.407-.449.175-.114.364-.17.566-.17.26 0 .463.07.611.207.148.138.257.361.323.668.066.308.097.735.097 1.281v.772h.002c0 .727-.089 1.26-.264 1.602-.175.342-.447.513-.818.513-.207 0-.394-.047-.564-.142a.93.93 0 01-.383-.391h-.024l-.11.46h-.907V13zm-6.563.246h3.252v.885h-1.09v5.789H6.576v-5.79h-1.09v-.884zm11.612 1.705c.376 0 .665.07.867.207.2.138.343.354.426.645.082.292.123.695.123 1.209v.836h-1.836v.248c0 .313.008.547.027.703.02.156.057.27.115.342.058.072.148.107.27.107.164 0 .277-.064.338-.191.06-.127.094-.338.1-.635l.947.055a1.6 1.6 0 01.007.175c0 .451-.124.788-.37 1.01-.248.223-.595.334-1.046.334-.54 0-.92-.17-1.138-.51-.218-.339-.326-.863-.326-1.574v-.851c0-.732.112-1.267.337-1.604.225-.337.613-.506 1.159-.506zm-8.688.094h1.1v3.58c0 .217.024.373.072.465.048.093.126.139.238.139a.486.486 0 00.276-.088.538.538 0 00.193-.223v-3.873h1.1v4.875h-.862l-.093-.598h-.026c-.234.452-.584.678-1.05.678-.325 0-.561-.106-.715-.318-.154-.212-.233-.544-.233-.994v-3.643zm8.664.648c-.117 0-.204.036-.26.104-.056.069-.093.182-.11.338a6.504 6.504 0 00-.028.71v.35h.803v-.35c0-.312-.01-.548-.032-.71-.02-.162-.059-.276-.115-.342-.056-.066-.14-.1-.258-.1zm-3.482.036a.418.418 0 00-.293.126.699.699 0 00-.192.327v2.767a.487.487 0 00.438.256.337.337 0 00.277-.127c.07-.085.12-.228.149-.43.029-.2.043-.48.043-.835v-.627c0-.382-.011-.676-.035-.883-.024-.207-.067-.357-.127-.444a.299.299 0 00-.26-.13z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'album') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M12 16.5q1.875 0 3.188-1.312Q16.5 13.875 16.5 12q0-1.875-1.312-3.188Q13.875 7.5 12 7.5q-1.875 0-3.188 1.312Q7.5 10.125 7.5 12q0 1.875 1.312 3.188Q10.125 16.5 12 16.5Zm0-3.5q-.425 0-.712-.288Q11 12.425 11 12t.288-.713Q11.575 11 12 11t.713.287Q13 11.575 13 12t-.287.712Q12.425 13 12 13Zm0 9q-2.075 0-3.9-.788-1.825-.787-3.175-2.137-1.35-1.35-2.137-3.175Q2 14.075 2 12t.788-3.9q.787-1.825 2.137-3.175 1.35-1.35 3.175-2.138Q9.925 2 12 2t3.9.787q1.825.788 3.175 2.138 1.35 1.35 2.137 3.175Q22 9.925 22 12t-.788 3.9q-.787 1.825-2.137 3.175-1.35 1.35-3.175 2.137Q14.075 22 12 22Zm0-2q3.35 0 5.675-2.325Q20 15.35 20 12q0-3.35-2.325-5.675Q15.35 4 12 4 8.65 4 6.325 6.325 4 8.65 4 12q0 3.35 2.325 5.675Q8.65 20 12 20Zm0-8Z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'local-offer') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M14.25 21.4q-.575.575-1.425.575-.85 0-1.425-.575l-8.8-8.8q-.275-.275-.437-.65Q2 11.575 2 11.15V4q0-.825.588-1.413Q3.175 2 4 2h7.15q.425 0 .8.162.375.163.65.438l8.8 8.825q.575.575.575 1.412 0 .838-.575 1.413ZM12.825 20l7.15-7.15L11.15 4H4v7.15ZM6.5 8q.625 0 1.062-.438Q8 7.125 8 6.5t-.438-1.062Q7.125 5 6.5 5t-1.062.438Q5 5.875 5 6.5t.438 1.062Q5.875 8 6.5 8ZM4 4Z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'trending-up') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M3.4 18 2 16.6l7.4-7.45 4 4L18.6 8H16V6h6v6h-2V9.4L13.4 16l-4-4Z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'new-releases') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'm8.6 22.5-1.9-3.2-3.6-.8.35-3.7L1 12l2.45-2.8-.35-3.7 3.6-.8 1.9-3.2L12 2.95l3.4-1.45 1.9 3.2 3.6.8-.35 3.7L23 12l-2.45 2.8.35 3.7-3.6.8-1.9 3.2-3.4-1.45Zm.85-2.55 2.55-1.1 2.6 1.1 1.4-2.4 2.75-.65-.25-2.8 1.85-2.1-1.85-2.15.25-2.8-2.75-.6-1.45-2.4L12 5.15l-2.6-1.1L8 6.45l-2.75.6.25 2.8L3.65 12l1.85 2.1-.25 2.85 2.75.6ZM12 12Zm-1.05 3.55L16.6 9.9l-1.4-1.45-4.25 4.25-2.15-2.1L7.4 12Z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'audiotrack') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M10 21q-1.65 0-2.825-1.175Q6 18.65 6 17q0-1.65 1.175-2.825Q8.35 13 10 13q.575 0 1.062.137.488.138.938.413V3h6v4h-4v10q0 1.65-1.175 2.825Q11.65 21 10 21Z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'mic') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M12 14q-1.25 0-2.125-.875T9 11V5q0-1.25.875-2.125T12 2q1.25 0 2.125.875T15 5v6q0 1.25-.875 2.125T12 14Zm0-6Zm-1 13v-3.075q-2.6-.35-4.3-2.325Q5 13.625 5 11h2q0 2.075 1.463 3.537Q9.925 16 12 16t3.538-1.463Q17 13.075 17 11h2q0 2.625-1.7 4.6-1.7 1.975-4.3 2.325V21Zm1-9q.425 0 .713-.288Q13 11.425 13 11V5q0-.425-.287-.713Q12.425 4 12 4t-.712.287Q11 4.575 11 5v6q0 .425.288.712.287.288.712.288Z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'history') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M12 21q-3.45 0-6.012-2.288Q3.425 16.425 3.05 13H5.1q.35 2.6 2.312 4.3Q9.375 19 12 19q2.925 0 4.962-2.038Q19 14.925 19 12t-2.038-4.963Q14.925 5 12 5q-1.725 0-3.225.8T6.25 8H9v2H3V4h2v2.35q1.275-1.6 3.113-2.475Q9.95 3 12 3q1.875 0 3.513.712 1.637.713 2.85 1.925 1.212 1.213 1.925 2.85Q21 10.125 21 12t-.712 3.512q-.713 1.638-1.925 2.85-1.213 1.213-2.85 1.926Q13.875 21 12 21Zm2.8-4.8L11 12.4V7h2v4.6l3.2 3.2Z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'search') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'm19.6 21-6.3-6.3q-.75.6-1.725.95Q10.6 16 9.5 16q-2.725 0-4.612-1.887Q3 12.225 3 9.5q0-2.725 1.888-4.613Q6.775 3 9.5 3t4.613 1.887Q16 6.775 16 9.5q0 1.1-.35 2.075-.35.975-.95 1.725l6.3 6.3ZM9.5 14q1.875 0 3.188-1.312Q14 11.375 14 9.5q0-1.875-1.312-3.188Q11.375 5 9.5 5 7.625 5 6.312 6.312 5 7.625 5 9.5q0 1.875 1.312 3.188Q7.625 14 9.5 14Z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
if ($item['icon'] === 'library-music') {
|
||||
$menus[$menuKey]['items'][$itemKey]['icon'] = [
|
||||
[
|
||||
'tag' => 'path',
|
||||
'attr' => [
|
||||
'd' =>
|
||||
'M12.5 15q1.05 0 1.775-.725Q15 13.55 15 12.5V7h3V5h-4v5.5q-.325-.25-.7-.375-.375-.125-.8-.125-1.05 0-1.775.725Q10 11.45 10 12.5q0 1.05.725 1.775Q11.45 15 12.5 15ZM8 18q-.825 0-1.412-.587Q6 16.825 6 16V4q0-.825.588-1.413Q7.175 2 8 2h12q.825 0 1.413.587Q22 3.175 22 4v12q0 .825-.587 1.413Q20.825 18 20 18Zm0-2h12V4H8v12Zm-4 6q-.825 0-1.412-.587Q2 20.825 2 20V6h2v14h14v2ZM8 4v12V4Z',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Setting::where('name', 'menus')->update([
|
||||
'value' => json_encode($menus),
|
||||
]);
|
||||
}
|
||||
|
||||
protected function migrateThemes()
|
||||
{
|
||||
CssTheme::all()->each(function (CssTheme $theme) {
|
||||
$newColors = [];
|
||||
$oldColors = json_decode($theme->getRawOriginal('colors'), true);
|
||||
$defaultColors = $theme->is_dark
|
||||
? config('common.themes.dark')
|
||||
: config('common.themes.light');
|
||||
|
||||
// theme was already migrated
|
||||
if (isset($oldColors['--be-disabled-bg-opacity'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$newColors['--be-foreground-base'] =
|
||||
$this->colorToPartialRgb($oldColors['--be-foreground-base']) ??
|
||||
$defaultColors['--be-foreground-base'];
|
||||
|
||||
$newColors['--be-primary-light'] =
|
||||
$this->colorToPartialRgb($oldColors['--be-accent-lighter']) ??
|
||||
$defaultColors['--be-primary-light'];
|
||||
|
||||
$newColors['--be-primary'] =
|
||||
$this->colorToPartialRgb($oldColors['--be-accent-default']) ??
|
||||
$defaultColors['--be-primary'];
|
||||
|
||||
$newColors['--be-primary-dark'] =
|
||||
$this->colorToPartialRgb(
|
||||
$oldColors['--be-primary-darker'],
|
||||
-0.1,
|
||||
) ?? $defaultColors['--be-primary-dark'];
|
||||
|
||||
$newColors['--be-on-primary'] =
|
||||
$this->colorToPartialRgb($oldColors['--be-accent-contrast']) ??
|
||||
$defaultColors['--be-on-primary'];
|
||||
|
||||
$newColors['--be-background'] =
|
||||
$this->colorToPartialRgb($oldColors['--be-background']) ??
|
||||
$defaultColors['--be-background'];
|
||||
|
||||
$newColors['--be-background-alt'] =
|
||||
$this->colorToPartialRgb(
|
||||
$oldColors['--be-background-alternative'],
|
||||
) ?? $defaultColors['--be-background-alt'];
|
||||
|
||||
$newColors['--be-background-chip'] =
|
||||
$this->colorToPartialRgb($oldColors['--be-chip']) ??
|
||||
$defaultColors['--be-background-chip'];
|
||||
|
||||
$newColors['--be-paper'] =
|
||||
$this->colorToPartialRgb($oldColors['--be-background']) ??
|
||||
$defaultColors['--be-paper'];
|
||||
|
||||
$newColors['--be-disabled-bg-opacity'] =
|
||||
$defaultColors['--be-disabled-bg-opacity'];
|
||||
$newColors['--be-disabled-fg-opacity'] =
|
||||
$defaultColors['--be-disabled-fg-opacity'];
|
||||
$newColors['--be-hover-opacity'] =
|
||||
$defaultColors['--be-hover-opacity'];
|
||||
$newColors['--be-focus-opacity'] =
|
||||
$defaultColors['--be-focus-opacity'];
|
||||
$newColors['--be-selected-opacity'] =
|
||||
$defaultColors['--be-selected-opacity'];
|
||||
$newColors['--be-text-main-opacity'] =
|
||||
$defaultColors['--be-text-main-opacity'];
|
||||
$newColors['--be-text-muted-opacity'] =
|
||||
$defaultColors['--be-text-muted-opacity'];
|
||||
$newColors['--be-divider-opacity'] =
|
||||
$defaultColors['--be-divider-opacity'];
|
||||
|
||||
$theme->colors = $newColors;
|
||||
$theme->save();
|
||||
});
|
||||
}
|
||||
|
||||
function colorToPartialRgb(
|
||||
mixed $colorString,
|
||||
float $brightness = 0,
|
||||
): string|null {
|
||||
try {
|
||||
$rgb = Factory::fromString($colorString)->toRgb();
|
||||
if ($brightness !== 0) {
|
||||
$rgb = Hex::fromString(
|
||||
$this->colourBrightness($rgb->toHex(), $brightness),
|
||||
)->toRgb();
|
||||
}
|
||||
return "{$rgb->red()} {$rgb->green()} {$rgb->blue()}";
|
||||
} catch (Exception) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function colourBrightness(string $hex, float $percent): string
|
||||
{
|
||||
// Work out if hash given
|
||||
$hash = '';
|
||||
if (stristr($hex, '#')) {
|
||||
$hex = str_replace('#', '', $hex);
|
||||
$hash = '#';
|
||||
}
|
||||
/// HEX TO RGB
|
||||
$rgb = [
|
||||
hexdec(substr($hex, 0, 2)),
|
||||
hexdec(substr($hex, 2, 2)),
|
||||
hexdec(substr($hex, 4, 2)),
|
||||
];
|
||||
//// CALCULATE
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
// See if brighter or darker
|
||||
if ($percent > 0) {
|
||||
// Lighter
|
||||
$rgb[$i] =
|
||||
round($rgb[$i] * $percent) + round(255 * (1 - $percent));
|
||||
} else {
|
||||
// Darker
|
||||
$positivePercent = $percent - $percent * 2;
|
||||
$rgb[$i] = round($rgb[$i] * (1 - $positivePercent)); // round($rgb[$i] * (1-$positivePercent));
|
||||
}
|
||||
// In case rounding up causes us to go to 256
|
||||
if ($rgb[$i] > 255) {
|
||||
$rgb[$i] = 255;
|
||||
}
|
||||
}
|
||||
//// RBG to Hex
|
||||
$hex = '';
|
||||
for ($i = 0; $i < 3; $i++) {
|
||||
// Convert the decimal digit to hex
|
||||
$hexDigit = dechex($rgb[$i]);
|
||||
// Add a leading zero if necessary
|
||||
if (strlen($hexDigit) == 1) {
|
||||
$hexDigit = '0' . $hexDigit;
|
||||
}
|
||||
// Append to the hex string
|
||||
$hex .= $hexDigit;
|
||||
}
|
||||
return $hash . $hex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert "ads.some.slot" to "ads.some_slot"
|
||||
*/
|
||||
protected function migrateAds()
|
||||
{
|
||||
$settings = Setting::where('name', 'like', 'ads.%')->get();
|
||||
$settings->each(function (Setting $setting) {
|
||||
if (substr_count($setting->name, '.') > 1) {
|
||||
$slot = str_replace('ads.', '', $setting->name);
|
||||
$setting->name = 'ads.' . str_replace('.', '_', $slot);
|
||||
$setting->save();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected function migrateLogos(): void
|
||||
{
|
||||
$isSvg = file_exists(public_path('images/logo-light.svg'));
|
||||
|
||||
Setting::where('name', 'branding.logo_dark')
|
||||
->where('value', 'client/assets/images/logo-dark.png')
|
||||
->update([
|
||||
'value' => $isSvg
|
||||
? 'images/logo-dark.svg'
|
||||
: 'images/logo-dark.png',
|
||||
]);
|
||||
|
||||
Setting::where('name', 'branding.logo_light')
|
||||
->where('value', 'client/assets/images/logo-light.png')
|
||||
->update([
|
||||
'value' => $isSvg
|
||||
? 'images/logo-light.svg'
|
||||
: 'images/logo-light.png',
|
||||
]);
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('personal_access_tokens', function (Blueprint $table) {
|
||||
$table->timestamp('expires_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('personal_access_tokens', function (Blueprint $table) {
|
||||
$table->dropColumn('expires_at');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$table
|
||||
->bigInteger('available_space')
|
||||
->nullable()
|
||||
->unsigned()
|
||||
->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Common\Notifications\NotificationSubscription;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
NotificationSubscription::chunkById(50, function (Collection $subs) {
|
||||
$subs->each(function (NotificationSubscription $sub) {
|
||||
$subChannels = $sub->channels;
|
||||
if (is_numeric(array_keys($subChannels)[0])) {
|
||||
$sub->channels = collect($subChannels)->mapWithKeys(
|
||||
fn($channel) => [$channel => true],
|
||||
);
|
||||
$sub->save();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('array_to_obj', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
|
||||
public function up()
|
||||
{
|
||||
Schema::table('file_entries', function (Blueprint $table) {
|
||||
$table->string('file_name', 50)->change();
|
||||
});
|
||||
}
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
||||
24
common/Database/migrations/2023_03_17_175502_add_user_id_to_tags_table.php
Executable file
24
common/Database/migrations/2023_03_17_175502_add_user_id_to_tags_table.php
Executable file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tags', function (Blueprint $table) {
|
||||
$table
|
||||
->unsignedBigInteger('user_id')
|
||||
->nullable()
|
||||
->index();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tags', function (Blueprint $table) {
|
||||
$table->dropColumn('user_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user