@fleetbase/storefront-engine 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.php-cs-fixer.php +29 -0
- package/LICENSE.md +16 -4
- package/README.md +106 -13
- package/composer.json +88 -0
- package/extension.json +10 -0
- package/package.json +6 -6
- package/phpstan.neon.dist +8 -0
- package/phpunit.xml.dist +16 -0
- package/server/.gitattributes +14 -0
- package/server/README.md +40 -0
- package/server/config/api.php +101 -0
- package/server/config/database.connections.php +57 -0
- package/server/config/storefront.php +19 -0
- package/server/config/twilio-notification-channel.php +36 -0
- package/server/migrations/2023_05_03_025307_create_carts_table.php +44 -0
- package/server/migrations/2023_05_03_025307_create_checkouts_table.php +51 -0
- package/server/migrations/2023_05_03_025307_create_gateways_table.php +48 -0
- package/server/migrations/2023_05_03_025307_create_network_stores_table.php +36 -0
- package/server/migrations/2023_05_03_025307_create_networks_table.php +56 -0
- package/server/migrations/2023_05_03_025307_create_notification_channels_table.php +43 -0
- package/server/migrations/2023_05_03_025307_create_payment_methods_table.php +44 -0
- package/server/migrations/2023_05_03_025307_create_product_addon_categories_table.php +38 -0
- package/server/migrations/2023_05_03_025307_create_product_addons_table.php +43 -0
- package/server/migrations/2023_05_03_025307_create_product_hours_table.php +37 -0
- package/server/migrations/2023_05_03_025307_create_product_store_locations_table.php +34 -0
- package/server/migrations/2023_05_03_025307_create_product_variant_options_table.php +40 -0
- package/server/migrations/2023_05_03_025307_create_product_variants_table.php +44 -0
- package/server/migrations/2023_05_03_025307_create_products_table.php +59 -0
- package/server/migrations/2023_05_03_025307_create_reviews_table.php +41 -0
- package/server/migrations/2023_05_03_025307_create_store_hours_table.php +37 -0
- package/server/migrations/2023_05_03_025307_create_store_locations_table.php +38 -0
- package/server/migrations/2023_05_03_025307_create_stores_table.php +57 -0
- package/server/migrations/2023_05_03_025307_create_votes_table.php +39 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_carts_table.php +40 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_checkouts_table.php +48 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_gateways_table.php +40 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_network_stores_table.php +40 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_networks_table.php +42 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_notification_channels_table.php +40 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_payment_methods_table.php +40 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_product_addon_categories_table.php +38 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_product_addons_table.php +38 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_product_hours_table.php +32 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_product_store_locations_table.php +34 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_product_variant_options_table.php +32 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_product_variants_table.php +32 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_products_table.php +44 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_reviews_table.php +38 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_store_hours_table.php +32 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_store_locations_table.php +40 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_stores_table.php +42 -0
- package/server/migrations/2023_05_03_025310_add_foreign_keys_to_votes_table.php +38 -0
- package/server/src/Auth/Schemas/Storefront.php +95 -0
- package/server/src/Console/Commands/NotifyStorefrontOrderNearby.php +86 -0
- package/server/src/Expansions/EntityExpansion.php +44 -0
- package/server/src/Http/Controllers/ActionController.php +119 -0
- package/server/src/Http/Controllers/AddonCategoryController.php +13 -0
- package/server/src/Http/Controllers/CustomerController.php +13 -0
- package/server/src/Http/Controllers/GatewayController.php +13 -0
- package/server/src/Http/Controllers/MetricsController.php +71 -0
- package/server/src/Http/Controllers/NetworkController.php +170 -0
- package/server/src/Http/Controllers/NotificationChannelController.php +13 -0
- package/server/src/Http/Controllers/OrderController.php +154 -0
- package/server/src/Http/Controllers/ProductAddonCategoryController.php +14 -0
- package/server/src/Http/Controllers/ProductAddonController.php +14 -0
- package/server/src/Http/Controllers/ProductController.php +123 -0
- package/server/src/Http/Controllers/ProductHourController.php +13 -0
- package/server/src/Http/Controllers/ProductVariantController.php +13 -0
- package/server/src/Http/Controllers/ProductVariantOptionController.php +13 -0
- package/server/src/Http/Controllers/ReviewController.php +13 -0
- package/server/src/Http/Controllers/StoreController.php +26 -0
- package/server/src/Http/Controllers/StoreHourController.php +13 -0
- package/server/src/Http/Controllers/StoreLocationController.php +13 -0
- package/server/src/Http/Controllers/StorefrontController.php +15 -0
- package/server/src/Http/Controllers/VoteController.php +13 -0
- package/server/src/Http/Controllers/v1/CartController.php +161 -0
- package/server/src/Http/Controllers/v1/CategoryController.php +138 -0
- package/server/src/Http/Controllers/v1/CheckoutController.php +957 -0
- package/server/src/Http/Controllers/v1/CustomerController.php +482 -0
- package/server/src/Http/Controllers/v1/GatewayControllerController.php +11 -0
- package/server/src/Http/Controllers/v1/NetworkController.php +281 -0
- package/server/src/Http/Controllers/v1/PaymentMethodController.php +11 -0
- package/server/src/Http/Controllers/v1/ProductController.php +94 -0
- package/server/src/Http/Controllers/v1/ReviewController.php +270 -0
- package/server/src/Http/Controllers/v1/ServiceQuoteController.php +402 -0
- package/server/src/Http/Controllers/v1/StoreController.php +176 -0
- package/server/src/Http/Filter/AddonCategoryFilter.php +19 -0
- package/server/src/Http/Filter/CustomerFilter.php +18 -0
- package/server/src/Http/Filter/GatewayFilter.php +13 -0
- package/server/src/Http/Filter/NetworkFilter.php +18 -0
- package/server/src/Http/Filter/NotificationChannelFilter.php +13 -0
- package/server/src/Http/Filter/OrderFilter.php +46 -0
- package/server/src/Http/Filter/ProductFilter.php +28 -0
- package/server/src/Http/Filter/StoreFilter.php +42 -0
- package/server/src/Http/Filter/StoreLocationFilter.php +23 -0
- package/server/src/Http/Middleware/SetStorefrontSession.php +130 -0
- package/server/src/Http/Requests/AddStoreToNetworkCategory.php +45 -0
- package/server/src/Http/Requests/CaptureOrderRequest.php +30 -0
- package/server/src/Http/Requests/CreateCustomerRequest.php +44 -0
- package/server/src/Http/Requests/CreateReviewRequest.php +34 -0
- package/server/src/Http/Requests/GetServiceQuoteFromCart.php +40 -0
- package/server/src/Http/Requests/InitializeCheckoutRequest.php +38 -0
- package/server/src/Http/Requests/NetworkActionRequest.php +43 -0
- package/server/src/Http/Requests/VerifyCreateCustomerRequest.php +31 -0
- package/server/src/Http/Resources/Cart.php +31 -0
- package/server/src/Http/Resources/Category.php +48 -0
- package/server/src/Http/Resources/Customer.php +36 -0
- package/server/src/Http/Resources/Gateway.php +32 -0
- package/server/src/Http/Resources/Media.php +29 -0
- package/server/src/Http/Resources/Network.php +48 -0
- package/server/src/Http/Resources/Product.php +209 -0
- package/server/src/Http/Resources/Review.php +45 -0
- package/server/src/Http/Resources/ReviewCustomer.php +60 -0
- package/server/src/Http/Resources/Store.php +76 -0
- package/server/src/Http/Resources/StoreHour.php +29 -0
- package/server/src/Http/Resources/StoreLocation.php +33 -0
- package/server/src/Imports/ProductsImport.php +20 -0
- package/server/src/Jobs/DownloadProductImageUrl.php +60 -0
- package/server/src/Listeners/HandleOrderCompleted.php +31 -0
- package/server/src/Listeners/HandleOrderDispatched.php +34 -0
- package/server/src/Listeners/HandleOrderDriverAssigned.php +37 -0
- package/server/src/Listeners/HandleOrderStarted.php +27 -0
- package/server/src/Mail/StorefrontNetworkInvite.php +48 -0
- package/server/src/Models/AddonCategory.php +30 -0
- package/server/src/Models/Cart.php +691 -0
- package/server/src/Models/Checkout.php +166 -0
- package/server/src/Models/Customer.php +88 -0
- package/server/src/Models/Gateway.php +165 -0
- package/server/src/Models/Network.php +300 -0
- package/server/src/Models/NetworkStore.php +86 -0
- package/server/src/Models/NotificationChannel.php +147 -0
- package/server/src/Models/PaymentMethod.php +99 -0
- package/server/src/Models/Product.php +315 -0
- package/server/src/Models/ProductAddon.php +128 -0
- package/server/src/Models/ProductAddonCategory.php +90 -0
- package/server/src/Models/ProductHour.php +59 -0
- package/server/src/Models/ProductStoreLocation.php +77 -0
- package/server/src/Models/ProductVariant.php +125 -0
- package/server/src/Models/ProductVariantOption.php +86 -0
- package/server/src/Models/Review.php +127 -0
- package/server/src/Models/Store.php +478 -0
- package/server/src/Models/StoreHour.php +59 -0
- package/server/src/Models/StoreLocation.php +126 -0
- package/server/src/Models/StorefrontModel.php +22 -0
- package/server/src/Models/Vote.php +84 -0
- package/server/src/Notifications/StorefrontOrderCanceled.php +196 -0
- package/server/src/Notifications/StorefrontOrderCompleted.php +201 -0
- package/server/src/Notifications/StorefrontOrderCreated.php +157 -0
- package/server/src/Notifications/StorefrontOrderDriverAssigned.php +200 -0
- package/server/src/Notifications/StorefrontOrderEnroute.php +199 -0
- package/server/src/Notifications/StorefrontOrderNearby.php +201 -0
- package/server/src/Notifications/StorefrontOrderPreparing.php +202 -0
- package/server/src/Notifications/StorefrontOrderReadyForPickup.php +202 -0
- package/server/src/Observers/NetworkObserver.php +40 -0
- package/server/src/Observers/ProductObserver.php +118 -0
- package/server/src/Providers/EventServiceProvider.php +23 -0
- package/server/src/Providers/StorefrontServiceProvider.php +103 -0
- package/server/src/Support/Metrics.php +193 -0
- package/server/src/Support/OrderConfig.php +13 -0
- package/server/src/Support/QPay.php +208 -0
- package/server/src/Support/Storefront.php +201 -0
- package/server/src/routes.php +180 -0
- package/server/tests/Feature.php +5 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Database\Schema\Blueprint;
|
|
5
|
+
use Illuminate\Support\Facades\Schema;
|
|
6
|
+
|
|
7
|
+
return new class extends Migration
|
|
8
|
+
{
|
|
9
|
+
/**
|
|
10
|
+
* Run the migrations.
|
|
11
|
+
*
|
|
12
|
+
* @return void
|
|
13
|
+
*/
|
|
14
|
+
public function up()
|
|
15
|
+
{
|
|
16
|
+
Schema::connection(config('storefront.connection.db'))->create('store_locations', function (Blueprint $table) {
|
|
17
|
+
$table->bigIncrements('id');
|
|
18
|
+
$table->string('public_id', 191)->nullable()->index();
|
|
19
|
+
$table->char('uuid', 36)->nullable()->unique();
|
|
20
|
+
$table->string('store_uuid', 191)->nullable()->index('store_locations_store_uuid_foreign');
|
|
21
|
+
$table->string('created_by_uuid', 191)->nullable()->index('store_locations_created_by_uuid_foreign');
|
|
22
|
+
$table->string('place_uuid', 191)->nullable()->index('store_locations_place_uuid_foreign');
|
|
23
|
+
$table->string('name')->nullable();
|
|
24
|
+
$table->softDeletes();
|
|
25
|
+
$table->timestamps();
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Reverse the migrations.
|
|
31
|
+
*
|
|
32
|
+
* @return void
|
|
33
|
+
*/
|
|
34
|
+
public function down()
|
|
35
|
+
{
|
|
36
|
+
Schema::connection(config('storefront.connection.db'))->dropIfExists('store_locations');
|
|
37
|
+
}
|
|
38
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Database\Schema\Blueprint;
|
|
5
|
+
use Illuminate\Support\Facades\Schema;
|
|
6
|
+
|
|
7
|
+
return new class extends Migration
|
|
8
|
+
{
|
|
9
|
+
/**
|
|
10
|
+
* Run the migrations.
|
|
11
|
+
*
|
|
12
|
+
* @return void
|
|
13
|
+
*/
|
|
14
|
+
public function up()
|
|
15
|
+
{
|
|
16
|
+
Schema::connection(config('storefront.connection.db'))->create('stores', function (Blueprint $table) {
|
|
17
|
+
$table->bigIncrements('id');
|
|
18
|
+
$table->string('public_id', 191)->nullable()->index();
|
|
19
|
+
$table->char('uuid', 36)->nullable()->unique();
|
|
20
|
+
$table->string('created_by_uuid', 191)->nullable()->index('stores_created_by_uuid_foreign');
|
|
21
|
+
$table->string('company_uuid', 191)->nullable()->index('stores_company_uuid_foreign');
|
|
22
|
+
$table->string('logo_uuid', 191)->nullable()->index('stores_logo_uuid_foreign');
|
|
23
|
+
$table->char('backdrop_uuid', 36)->nullable()->index('stores_backdrop_uuid_foreign');
|
|
24
|
+
$table->string('name')->nullable();
|
|
25
|
+
$table->longText('description')->nullable();
|
|
26
|
+
$table->string('phone')->nullable();
|
|
27
|
+
$table->string('email')->nullable();
|
|
28
|
+
$table->string('website')->nullable();
|
|
29
|
+
$table->string('facebook')->nullable();
|
|
30
|
+
$table->string('instagram')->nullable();
|
|
31
|
+
$table->string('twitter')->nullable();
|
|
32
|
+
$table->json('tags')->nullable();
|
|
33
|
+
$table->json('translations')->nullable();
|
|
34
|
+
$table->longText('key')->nullable();
|
|
35
|
+
$table->boolean('online')->default(true)->index();
|
|
36
|
+
$table->string('currency')->nullable();
|
|
37
|
+
$table->string('timezone')->nullable();
|
|
38
|
+
$table->string('pod_method')->nullable();
|
|
39
|
+
$table->json('options')->nullable();
|
|
40
|
+
$table->json('alertable')->nullable();
|
|
41
|
+
$table->json('meta')->nullable();
|
|
42
|
+
$table->string('slug', 191)->nullable()->index();
|
|
43
|
+
$table->softDeletes();
|
|
44
|
+
$table->timestamps();
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Reverse the migrations.
|
|
50
|
+
*
|
|
51
|
+
* @return void
|
|
52
|
+
*/
|
|
53
|
+
public function down()
|
|
54
|
+
{
|
|
55
|
+
Schema::connection(config('storefront.connection.db'))->dropIfExists('stores');
|
|
56
|
+
}
|
|
57
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Database\Schema\Blueprint;
|
|
5
|
+
use Illuminate\Support\Facades\Schema;
|
|
6
|
+
|
|
7
|
+
return new class extends Migration
|
|
8
|
+
{
|
|
9
|
+
/**
|
|
10
|
+
* Run the migrations.
|
|
11
|
+
*
|
|
12
|
+
* @return void
|
|
13
|
+
*/
|
|
14
|
+
public function up()
|
|
15
|
+
{
|
|
16
|
+
Schema::connection(config('storefront.connection.db'))->create('votes', function (Blueprint $table) {
|
|
17
|
+
$table->bigIncrements('id');
|
|
18
|
+
$table->char('uuid', 36)->nullable()->unique();
|
|
19
|
+
$table->string('public_id')->nullable()->unique();
|
|
20
|
+
$table->string('created_by_uuid')->nullable()->index('votes_created_by_uuid_foreign');
|
|
21
|
+
$table->char('customer_uuid', 36)->nullable()->index('votes_customer_uuid_foreign');
|
|
22
|
+
$table->char('subject_uuid', 36)->nullable();
|
|
23
|
+
$table->string('subject_type')->nullable();
|
|
24
|
+
$table->string('type')->nullable();
|
|
25
|
+
$table->softDeletes();
|
|
26
|
+
$table->timestamps();
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Reverse the migrations.
|
|
32
|
+
*
|
|
33
|
+
* @return void
|
|
34
|
+
*/
|
|
35
|
+
public function down()
|
|
36
|
+
{
|
|
37
|
+
Schema::connection(config('storefront.connection.db'))->dropIfExists('votes');
|
|
38
|
+
}
|
|
39
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Database\Schema\Blueprint;
|
|
5
|
+
use Illuminate\Database\Query\Expression;
|
|
6
|
+
use Illuminate\Support\Facades\Schema;
|
|
7
|
+
use Fleetbase\Support\Utils;
|
|
8
|
+
|
|
9
|
+
return new class extends Migration
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* Run the migrations.
|
|
13
|
+
*
|
|
14
|
+
* @return void
|
|
15
|
+
*/
|
|
16
|
+
public function up()
|
|
17
|
+
{
|
|
18
|
+
$databaseName = Utils::getFleetbaseDatabaseName();
|
|
19
|
+
|
|
20
|
+
Schema::connection(config('storefront.connection.db'))->table('carts', function (Blueprint $table) use ($databaseName) {
|
|
21
|
+
$table->foreign(['checkout_uuid'])->references(['uuid'])->on('checkouts')->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
22
|
+
$table->foreign(['company_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.companies'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
23
|
+
$table->foreign(['user_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.users'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Reverse the migrations.
|
|
29
|
+
*
|
|
30
|
+
* @return void
|
|
31
|
+
*/
|
|
32
|
+
public function down()
|
|
33
|
+
{
|
|
34
|
+
Schema::connection(config('storefront.connection.db'))->table('carts', function (Blueprint $table) {
|
|
35
|
+
$table->dropForeign('carts_checkout_uuid_foreign');
|
|
36
|
+
$table->dropForeign('carts_company_uuid_foreign');
|
|
37
|
+
$table->dropForeign('carts_user_uuid_foreign');
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Database\Schema\Blueprint;
|
|
5
|
+
use Illuminate\Database\Query\Expression;
|
|
6
|
+
use Illuminate\Support\Facades\Schema;
|
|
7
|
+
use Fleetbase\Support\Utils;
|
|
8
|
+
|
|
9
|
+
return new class extends Migration
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* Run the migrations.
|
|
13
|
+
*
|
|
14
|
+
* @return void
|
|
15
|
+
*/
|
|
16
|
+
public function up()
|
|
17
|
+
{
|
|
18
|
+
$databaseName = Utils::getFleetbaseDatabaseName();
|
|
19
|
+
|
|
20
|
+
Schema::connection(config('storefront.connection.db'))->table('checkouts', function (Blueprint $table) use ($databaseName) {
|
|
21
|
+
$table->foreign(['cart_uuid'])->references(['uuid'])->on('carts')->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
22
|
+
$table->foreign(['company_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.companies'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
23
|
+
$table->foreign(['gateway_uuid'])->references(['uuid'])->on('gateways')->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
24
|
+
$table->foreign(['network_uuid'])->references(['uuid'])->on('networks')->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
25
|
+
$table->foreign(['order_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.orders'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
26
|
+
$table->foreign(['service_quote_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.service_quotes'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
27
|
+
$table->foreign(['store_uuid'])->references(['uuid'])->on('stores')->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Reverse the migrations.
|
|
33
|
+
*
|
|
34
|
+
* @return void
|
|
35
|
+
*/
|
|
36
|
+
public function down()
|
|
37
|
+
{
|
|
38
|
+
Schema::connection(config('storefront.connection.db'))->table('checkouts', function (Blueprint $table) {
|
|
39
|
+
$table->dropForeign('checkouts_cart_uuid_foreign');
|
|
40
|
+
$table->dropForeign('checkouts_company_uuid_foreign');
|
|
41
|
+
$table->dropForeign('checkouts_gateway_uuid_foreign');
|
|
42
|
+
$table->dropForeign('checkouts_network_uuid_foreign');
|
|
43
|
+
$table->dropForeign('checkouts_order_uuid_foreign');
|
|
44
|
+
$table->dropForeign('checkouts_service_quote_uuid_foreign');
|
|
45
|
+
$table->dropForeign('checkouts_store_uuid_foreign');
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Database\Schema\Blueprint;
|
|
5
|
+
use Illuminate\Database\Query\Expression;
|
|
6
|
+
use Illuminate\Support\Facades\Schema;
|
|
7
|
+
use Fleetbase\Support\Utils;
|
|
8
|
+
|
|
9
|
+
return new class extends Migration
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* Run the migrations.
|
|
13
|
+
*
|
|
14
|
+
* @return void
|
|
15
|
+
*/
|
|
16
|
+
public function up()
|
|
17
|
+
{
|
|
18
|
+
$databaseName = Utils::getFleetbaseDatabaseName();
|
|
19
|
+
|
|
20
|
+
Schema::connection(config('storefront.connection.db'))->table('gateways', function (Blueprint $table) use ($databaseName) {
|
|
21
|
+
$table->foreign(['company_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.companies'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
22
|
+
$table->foreign(['created_by_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.users'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
23
|
+
$table->foreign(['logo_file_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.files'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Reverse the migrations.
|
|
29
|
+
*
|
|
30
|
+
* @return void
|
|
31
|
+
*/
|
|
32
|
+
public function down()
|
|
33
|
+
{
|
|
34
|
+
Schema::connection(config('storefront.connection.db'))->table('gateways', function (Blueprint $table) {
|
|
35
|
+
$table->dropForeign('gateways_company_uuid_foreign');
|
|
36
|
+
$table->dropForeign('gateways_created_by_uuid_foreign');
|
|
37
|
+
$table->dropForeign('gateways_logo_file_uuid_foreign');
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Database\Schema\Blueprint;
|
|
5
|
+
use Illuminate\Database\Query\Expression;
|
|
6
|
+
use Illuminate\Support\Facades\Schema;
|
|
7
|
+
use Fleetbase\Support\Utils;
|
|
8
|
+
|
|
9
|
+
return new class extends Migration
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* Run the migrations.
|
|
13
|
+
*
|
|
14
|
+
* @return void
|
|
15
|
+
*/
|
|
16
|
+
public function up()
|
|
17
|
+
{
|
|
18
|
+
$databaseName = Utils::getFleetbaseDatabaseName();
|
|
19
|
+
|
|
20
|
+
Schema::connection(config('storefront.connection.db'))->table('network_stores', function (Blueprint $table) use ($databaseName) {
|
|
21
|
+
$table->foreign(['category_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.categories'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
22
|
+
$table->foreign(['network_uuid'])->references(['uuid'])->on('networks')->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
23
|
+
$table->foreign(['store_uuid'])->references(['uuid'])->on('stores')->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Reverse the migrations.
|
|
29
|
+
*
|
|
30
|
+
* @return void
|
|
31
|
+
*/
|
|
32
|
+
public function down()
|
|
33
|
+
{
|
|
34
|
+
Schema::connection(config('storefront.connection.db'))->table('network_stores', function (Blueprint $table) {
|
|
35
|
+
$table->dropForeign('network_stores_category_uuid_foreign');
|
|
36
|
+
$table->dropForeign('network_stores_network_uuid_foreign');
|
|
37
|
+
$table->dropForeign('network_stores_store_uuid_foreign');
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Database\Schema\Blueprint;
|
|
5
|
+
use Illuminate\Database\Query\Expression;
|
|
6
|
+
use Illuminate\Support\Facades\Schema;
|
|
7
|
+
use Fleetbase\Support\Utils;
|
|
8
|
+
|
|
9
|
+
return new class extends Migration
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* Run the migrations.
|
|
13
|
+
*
|
|
14
|
+
* @return void
|
|
15
|
+
*/
|
|
16
|
+
public function up()
|
|
17
|
+
{
|
|
18
|
+
$databaseName = Utils::getFleetbaseDatabaseName();
|
|
19
|
+
|
|
20
|
+
Schema::connection(config('storefront.connection.db'))->table('networks', function (Blueprint $table) use ($databaseName) {
|
|
21
|
+
$table->foreign(['backdrop_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.files'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
22
|
+
$table->foreign(['company_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.companies'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
23
|
+
$table->foreign(['created_by_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.users'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
24
|
+
$table->foreign(['logo_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.files'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Reverse the migrations.
|
|
30
|
+
*
|
|
31
|
+
* @return void
|
|
32
|
+
*/
|
|
33
|
+
public function down()
|
|
34
|
+
{
|
|
35
|
+
Schema::connection(config('storefront.connection.db'))->table('networks', function (Blueprint $table) {
|
|
36
|
+
$table->dropForeign('networks_backdrop_uuid_foreign');
|
|
37
|
+
$table->dropForeign('networks_company_uuid_foreign');
|
|
38
|
+
$table->dropForeign('networks_created_by_uuid_foreign');
|
|
39
|
+
$table->dropForeign('networks_logo_uuid_foreign');
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|
package/server/migrations/2023_05_03_025310_add_foreign_keys_to_notification_channels_table.php
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Database\Schema\Blueprint;
|
|
5
|
+
use Illuminate\Database\Query\Expression;
|
|
6
|
+
use Illuminate\Support\Facades\Schema;
|
|
7
|
+
use Fleetbase\Support\Utils;
|
|
8
|
+
|
|
9
|
+
return new class extends Migration
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* Run the migrations.
|
|
13
|
+
*
|
|
14
|
+
* @return void
|
|
15
|
+
*/
|
|
16
|
+
public function up()
|
|
17
|
+
{
|
|
18
|
+
$databaseName = Utils::getFleetbaseDatabaseName();
|
|
19
|
+
|
|
20
|
+
Schema::connection(config('storefront.connection.db'))->table('notification_channels', function (Blueprint $table) use ($databaseName) {
|
|
21
|
+
$table->foreign(['certificate_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.files'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
22
|
+
$table->foreign(['company_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.companies'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
23
|
+
$table->foreign(['created_by_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.users'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Reverse the migrations.
|
|
29
|
+
*
|
|
30
|
+
* @return void
|
|
31
|
+
*/
|
|
32
|
+
public function down()
|
|
33
|
+
{
|
|
34
|
+
Schema::connection(config('storefront.connection.db'))->table('notification_channels', function (Blueprint $table) {
|
|
35
|
+
$table->dropForeign('notification_channels_certificate_uuid_foreign');
|
|
36
|
+
$table->dropForeign('notification_channels_company_uuid_foreign');
|
|
37
|
+
$table->dropForeign('notification_channels_created_by_uuid_foreign');
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Database\Schema\Blueprint;
|
|
5
|
+
use Illuminate\Database\Query\Expression;
|
|
6
|
+
use Illuminate\Support\Facades\Schema;
|
|
7
|
+
use Fleetbase\Support\Utils;
|
|
8
|
+
|
|
9
|
+
return new class extends Migration
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* Run the migrations.
|
|
13
|
+
*
|
|
14
|
+
* @return void
|
|
15
|
+
*/
|
|
16
|
+
public function up()
|
|
17
|
+
{
|
|
18
|
+
$databaseName = Utils::getFleetbaseDatabaseName();
|
|
19
|
+
|
|
20
|
+
Schema::connection(config('storefront.connection.db'))->table('payment_methods', function (Blueprint $table) use ($databaseName) {
|
|
21
|
+
$table->foreign(['company_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.companies'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
22
|
+
$table->foreign(['gateway_uuid'])->references(['uuid'])->on('gateways')->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
23
|
+
$table->foreign(['store_uuid'])->references(['uuid'])->on('stores')->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Reverse the migrations.
|
|
29
|
+
*
|
|
30
|
+
* @return void
|
|
31
|
+
*/
|
|
32
|
+
public function down()
|
|
33
|
+
{
|
|
34
|
+
Schema::connection(config('storefront.connection.db'))->table('payment_methods', function (Blueprint $table) {
|
|
35
|
+
$table->dropForeign('payment_methods_company_uuid_foreign');
|
|
36
|
+
$table->dropForeign('payment_methods_gateway_uuid_foreign');
|
|
37
|
+
$table->dropForeign('payment_methods_store_uuid_foreign');
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
};
|
package/server/migrations/2023_05_03_025310_add_foreign_keys_to_product_addon_categories_table.php
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Database\Schema\Blueprint;
|
|
5
|
+
use Illuminate\Database\Query\Expression;
|
|
6
|
+
use Illuminate\Support\Facades\Schema;
|
|
7
|
+
use Fleetbase\Support\Utils;
|
|
8
|
+
|
|
9
|
+
return new class extends Migration
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* Run the migrations.
|
|
13
|
+
*
|
|
14
|
+
* @return void
|
|
15
|
+
*/
|
|
16
|
+
public function up()
|
|
17
|
+
{
|
|
18
|
+
$databaseName = Utils::getFleetbaseDatabaseName();
|
|
19
|
+
|
|
20
|
+
Schema::connection(config('storefront.connection.db'))->table('product_addon_categories', function (Blueprint $table) use ($databaseName) {
|
|
21
|
+
$table->foreign(['category_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.categories'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
22
|
+
$table->foreign(['product_uuid'])->references(['uuid'])->on('products')->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Reverse the migrations.
|
|
28
|
+
*
|
|
29
|
+
* @return void
|
|
30
|
+
*/
|
|
31
|
+
public function down()
|
|
32
|
+
{
|
|
33
|
+
Schema::connection(config('storefront.connection.db'))->table('product_addon_categories', function (Blueprint $table) {
|
|
34
|
+
$table->dropForeign('product_addon_categories_category_uuid_foreign');
|
|
35
|
+
$table->dropForeign('product_addon_categories_product_uuid_foreign');
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Database\Schema\Blueprint;
|
|
5
|
+
use Illuminate\Database\Query\Expression;
|
|
6
|
+
use Illuminate\Support\Facades\Schema;
|
|
7
|
+
use Fleetbase\Support\Utils;
|
|
8
|
+
|
|
9
|
+
return new class extends Migration
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* Run the migrations.
|
|
13
|
+
*
|
|
14
|
+
* @return void
|
|
15
|
+
*/
|
|
16
|
+
public function up()
|
|
17
|
+
{
|
|
18
|
+
$databaseName = Utils::getFleetbaseDatabaseName();
|
|
19
|
+
|
|
20
|
+
Schema::connection(config('storefront.connection.db'))->table('product_addons', function (Blueprint $table) use ($databaseName) {
|
|
21
|
+
$table->foreign(['category_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.categories'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
22
|
+
$table->foreign(['created_by_uuid'])->references(['uuid'])->on(new Expression($databaseName . '.users'))->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Reverse the migrations.
|
|
28
|
+
*
|
|
29
|
+
* @return void
|
|
30
|
+
*/
|
|
31
|
+
public function down()
|
|
32
|
+
{
|
|
33
|
+
Schema::connection(config('storefront.connection.db'))->table('product_addons', function (Blueprint $table) {
|
|
34
|
+
$table->dropForeign('product_addons_category_uuid_foreign');
|
|
35
|
+
$table->dropForeign('product_addons_created_by_uuid_foreign');
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Database\Schema\Blueprint;
|
|
5
|
+
use Illuminate\Support\Facades\Schema;
|
|
6
|
+
|
|
7
|
+
return new class extends Migration
|
|
8
|
+
{
|
|
9
|
+
/**
|
|
10
|
+
* Run the migrations.
|
|
11
|
+
*
|
|
12
|
+
* @return void
|
|
13
|
+
*/
|
|
14
|
+
public function up()
|
|
15
|
+
{
|
|
16
|
+
Schema::connection(config('storefront.connection.db'))->table('product_hours', function (Blueprint $table) {
|
|
17
|
+
$table->foreign(['product_uuid'])->references(['uuid'])->on('products')->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Reverse the migrations.
|
|
23
|
+
*
|
|
24
|
+
* @return void
|
|
25
|
+
*/
|
|
26
|
+
public function down()
|
|
27
|
+
{
|
|
28
|
+
Schema::connection(config('storefront.connection.db'))->table('product_hours', function (Blueprint $table) {
|
|
29
|
+
$table->dropForeign('product_hours_product_uuid_foreign');
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
};
|
package/server/migrations/2023_05_03_025310_add_foreign_keys_to_product_store_locations_table.php
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Database\Schema\Blueprint;
|
|
5
|
+
use Illuminate\Support\Facades\Schema;
|
|
6
|
+
|
|
7
|
+
return new class extends Migration
|
|
8
|
+
{
|
|
9
|
+
/**
|
|
10
|
+
* Run the migrations.
|
|
11
|
+
*
|
|
12
|
+
* @return void
|
|
13
|
+
*/
|
|
14
|
+
public function up()
|
|
15
|
+
{
|
|
16
|
+
Schema::connection(config('storefront.connection.db'))->table('product_store_locations', function (Blueprint $table) {
|
|
17
|
+
$table->foreign(['product_uuid'])->references(['uuid'])->on('products')->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
18
|
+
$table->foreign(['store_location_uuid'])->references(['uuid'])->on('store_locations')->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Reverse the migrations.
|
|
24
|
+
*
|
|
25
|
+
* @return void
|
|
26
|
+
*/
|
|
27
|
+
public function down()
|
|
28
|
+
{
|
|
29
|
+
Schema::connection(config('storefront.connection.db'))->table('product_store_locations', function (Blueprint $table) {
|
|
30
|
+
$table->dropForeign('product_store_locations_product_uuid_foreign');
|
|
31
|
+
$table->dropForeign('product_store_locations_store_location_uuid_foreign');
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
package/server/migrations/2023_05_03_025310_add_foreign_keys_to_product_variant_options_table.php
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Database\Schema\Blueprint;
|
|
5
|
+
use Illuminate\Support\Facades\Schema;
|
|
6
|
+
|
|
7
|
+
return new class extends Migration
|
|
8
|
+
{
|
|
9
|
+
/**
|
|
10
|
+
* Run the migrations.
|
|
11
|
+
*
|
|
12
|
+
* @return void
|
|
13
|
+
*/
|
|
14
|
+
public function up()
|
|
15
|
+
{
|
|
16
|
+
Schema::connection(config('storefront.connection.db'))->table('product_variant_options', function (Blueprint $table) {
|
|
17
|
+
$table->foreign(['product_variant_uuid'])->references(['uuid'])->on('product_variants')->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Reverse the migrations.
|
|
23
|
+
*
|
|
24
|
+
* @return void
|
|
25
|
+
*/
|
|
26
|
+
public function down()
|
|
27
|
+
{
|
|
28
|
+
Schema::connection(config('storefront.connection.db'))->table('product_variant_options', function (Blueprint $table) {
|
|
29
|
+
$table->dropForeign('product_variant_options_product_variant_uuid_foreign');
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Database\Schema\Blueprint;
|
|
5
|
+
use Illuminate\Support\Facades\Schema;
|
|
6
|
+
|
|
7
|
+
return new class extends Migration
|
|
8
|
+
{
|
|
9
|
+
/**
|
|
10
|
+
* Run the migrations.
|
|
11
|
+
*
|
|
12
|
+
* @return void
|
|
13
|
+
*/
|
|
14
|
+
public function up()
|
|
15
|
+
{
|
|
16
|
+
Schema::connection(config('storefront.connection.db'))->table('product_variants', function (Blueprint $table) {
|
|
17
|
+
$table->foreign(['product_uuid'])->references(['uuid'])->on('products')->onUpdate('NO ACTION')->onDelete('NO ACTION');
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Reverse the migrations.
|
|
23
|
+
*
|
|
24
|
+
* @return void
|
|
25
|
+
*/
|
|
26
|
+
public function down()
|
|
27
|
+
{
|
|
28
|
+
Schema::connection(config('storefront.connection.db'))->table('product_variants', function (Blueprint $table) {
|
|
29
|
+
$table->dropForeign('product_variants_product_uuid_foreign');
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
};
|