Merge branch 'dillon/34.6-jenkins-vapor' into vapor/development

This commit is contained in:
Dillon Ngo
2024-08-14 02:22:35 +08:00
226 changed files with 4085 additions and 466 deletions
@@ -0,0 +1,24 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateModelAttributesTable extends Migration
{
public function up()
{
Schema::create('model_attributes', function (Blueprint $table) {
$table->id();
$table->morphs('owner');
$table->string('name');
$table->json('value');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('model_attributes');
}
}
@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateVoucherCampaignsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('voucher_campaigns', function (Blueprint $table) {
$table->id();
$table->string('campaign_id');
$table->string('name');
$table->string('slug')->unique();
$table->text('description')->nullable();
$table->integer('limit_per_month')->default(0);
$table->boolean('is_display')->default(false);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('voucher_campaigns');
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddVoucherCampaignIdToVouchersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('vouchers', function (Blueprint $table) {
$table->foreignId('voucher_campaign_id')->nullable()->constrained('voucher_campaigns')->onDelete('set null');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('vouchers', function (Blueprint $table) {
$table->dropForeign(['voucher_campaign_id']);
$table->dropColumn('voucher_campaign_id');
});
}
}
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCreatedByAndCreatorTypeToBanksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('banks', function (Blueprint $table) {
$table->unsignedBigInteger('created_by')->nullable()->after('country_id');
$table->unsignedInteger('creator_type')->nullable()->after('created_by'); // 'admin' or 'customer', see RoleTypes.php for more
$table->foreign('created_by')->references('id')->on('users')->onDelete('set null');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('banks', function (Blueprint $table) {
$table->dropForeign(['created_by']);
$table->dropColumn(['created_by', 'creator_type']);
});
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddDeletedAtToKeyValuePairs extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('key_value_pairs', function (Blueprint $table) {
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('key_value_pairs', function (Blueprint $table) {
$table->dropSoftDeletes();
});
}
}
@@ -71,6 +71,10 @@ class AdminUserPermissionsTableSeeder extends Seeder
['name' => 'delete milestone', 'guard_name' => 'web'],
['name' => 'delete reward', 'guard_name' => 'web'],
['name' => 'add voucher', 'guard_name' => 'web'],
['name' => 'list voucher campaigns', 'guard_name' => 'web'],
['name' => 'update bank_metadata', 'guard_name' => 'web'],
];
foreach ($permissions as $permission){