breaking: move shared HTTP utils to the framework (#9402)

Fixes: FRMW-2728, FRMW-2729

After this PR gets merged the following middleware will be exported from the `@medusajs/framework/http` import path.

- applyParamsAsFilters
- clearFiltersByKey
- applyDefaultFilters
- setContext
- getQueryConfig
- httpCompression
- maybeApplyLinkFilter
- refetchEntities
- unlessPath
- validateBody
- validateQuery

Co-authored-by: Adrien de Peretti <25098370+adrien2p@users.noreply.github.com>
This commit is contained in:
Harminder Virk
2024-10-03 09:42:00 +00:00
committed by GitHub
co-authored by Adrien de Peretti
parent 193f93464f
commit 48e00169d2
557 changed files with 2365 additions and 3499 deletions
@@ -1,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -126,9 +124,7 @@
"indexes": [
{
"keyName": "IDX_api_key_token_unique",
"columnNames": [
"token"
],
"columnNames": ["token"],
"composite": false,
"primary": false,
"unique": false,
@@ -136,9 +132,7 @@
},
{
"keyName": "IDX_api_key_type",
"columnNames": [
"type"
],
"columnNames": ["type"],
"composite": false,
"primary": false,
"unique": false,
@@ -146,9 +140,7 @@
},
{
"keyName": "api_key_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -1,13 +1,15 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@mikro-orm/migrations"
export class Migration20240604080145 extends Migration {
async up(): Promise<void> {
this.addSql('alter table if exists "api_key" add column if not exists "updated_at" timestamptz not null default now();');
this.addSql(
'alter table if exists "api_key" add column if not exists "updated_at" timestamptz not null default now();'
)
}
async down(): Promise<void> {
this.addSql('alter table if exists "api_key" drop column if exists "updated_at";');
this.addSql(
'alter table if exists "api_key" drop column if exists "updated_at";'
)
}
}
@@ -1,8 +1,8 @@
import {
AuthIdentityDTO,
AuthIdentityProviderService,
AuthenticationInput,
AuthenticationResponse,
AuthIdentityDTO,
AuthIdentityProviderService,
} from "@medusajs/framework/types"
import {
AbstractAuthModuleProvider,
@@ -1,7 +1,7 @@
import { IAuthModuleService } from "@medusajs/framework/types"
import { Module, Modules } from "@medusajs/framework/utils"
import { AuthModuleService } from "@services"
import { SuiteOptions, moduleIntegrationTestRunner } from "medusa-test-utils"
import { moduleIntegrationTestRunner, SuiteOptions } from "medusa-test-utils"
import { resolve } from "path"
let moduleOptions = {
@@ -1,9 +1,9 @@
import {
LoaderOptions,
ModulesSdkTypes,
ModuleProvider,
ModulesSdkTypes,
} from "@medusajs/framework/types"
import { Lifetime, asFunction, asValue } from "awilix"
import { asFunction, asValue, Lifetime } from "awilix"
import { moduleProviderLoader } from "@medusajs/framework/modules-sdk"
import {
AuthIdentifiersRegistrationName,
@@ -1,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -52,9 +50,7 @@
"indexes": [
{
"keyName": "auth_identity_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -163,9 +159,7 @@
},
{
"keyName": "provider_identity_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -175,13 +169,9 @@
"foreignKeys": {
"provider_identity_auth_identity_id_foreign": {
"constraintName": "provider_identity_auth_identity_id_foreign",
"columnNames": [
"auth_identity_id"
],
"columnNames": ["auth_identity_id"],
"localTableName": "public.provider_identity",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.auth_identity",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -2,8 +2,8 @@ import {
BeforeCreate,
Collection,
Entity,
OnInit,
OneToMany,
OnInit,
PrimaryKey,
Property,
} from "@mikro-orm/core"
@@ -1,8 +1,8 @@
import {
AuthIdentityProviderService,
AuthTypes,
AuthenticationInput,
AuthenticationResponse,
AuthIdentityProviderService,
AuthTypes,
} from "@medusajs/framework/types"
import { MedusaError } from "@medusajs/framework/utils"
import { AuthProviderRegistrationPrefix } from "@types"
+5 -3
View File
@@ -1,6 +1,8 @@
import { ModuleProviderExports } from "@medusajs/framework/types"
import { ModuleServiceInitializeOptions } from "@medusajs/framework/types"
import { Logger } from "@medusajs/framework/types"
import {
Logger,
ModuleProviderExports,
ModuleServiceInitializeOptions,
} from "@medusajs/framework/types"
export type InitializeModuleInjectableDependencies = {
logger?: Logger
+3 -1
View File
@@ -17,7 +17,9 @@ yarn add @medusajs/cache-inmemory
```
### Note
Recommended for testing and development. For production, use Redis cache module.
Recommended for testing and development. For production, use Redis cache module.
### Other caching modules
- [Medusa Cache Redis](../cache-redis/README.md)
+4 -3
View File
@@ -13,14 +13,15 @@ yarn add @medusajs/cache-redis
```
{
ttl?: number // Time to keep data in cache (in seconds)
redisUrl?: string // Redis instance connection string
redisOptions?: RedisOptions // Redis client options
namespace?: string // Prefix for event keys (the default is `medusa:`)
}
```
### Other caching modules
- [Medusa Cache In-Memory](../cache-inmemory/README.md)
@@ -1,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -161,9 +159,7 @@
"indexes": [
{
"keyName": "IDX_cart_address_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -171,9 +167,7 @@
},
{
"keyName": "cart_address_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -302,27 +296,21 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"sales_channel_id"
],
"columnNames": ["sales_channel_id"],
"composite": false,
"keyName": "IDX_cart_sales_channel_id",
"primary": false,
"unique": false
},
{
"columnNames": [
"currency_code"
],
"columnNames": ["currency_code"],
"composite": false,
"keyName": "IDX_cart_curency_code",
"primary": false,
"unique": false
},
{
"columnNames": [
"billing_address_id"
],
"columnNames": ["billing_address_id"],
"composite": false,
"keyName": "IDX_cart_billing_address_id",
"primary": false,
@@ -330,9 +318,7 @@
},
{
"keyName": "IDX_cart_region_id",
"columnNames": [
"region_id"
],
"columnNames": ["region_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -340,9 +326,7 @@
},
{
"keyName": "IDX_cart_customer_id",
"columnNames": [
"customer_id"
],
"columnNames": ["customer_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -350,9 +334,7 @@
},
{
"keyName": "IDX_cart_sales_channel_id",
"columnNames": [
"sales_channel_id"
],
"columnNames": ["sales_channel_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -360,9 +342,7 @@
},
{
"keyName": "IDX_cart_shipping_address_id",
"columnNames": [
"shipping_address_id"
],
"columnNames": ["shipping_address_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -370,9 +350,7 @@
},
{
"keyName": "IDX_cart_billing_address_id",
"columnNames": [
"billing_address_id"
],
"columnNames": ["billing_address_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -380,9 +358,7 @@
},
{
"keyName": "IDX_cart_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -390,9 +366,7 @@
},
{
"keyName": "cart_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -402,26 +376,18 @@
"foreignKeys": {
"cart_shipping_address_id_foreign": {
"constraintName": "cart_shipping_address_id_foreign",
"columnNames": [
"shipping_address_id"
],
"columnNames": ["shipping_address_id"],
"localTableName": "public.cart",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.cart_address",
"deleteRule": "set null",
"updateRule": "cascade"
},
"cart_billing_address_id_foreign": {
"constraintName": "cart_billing_address_id_foreign",
"columnNames": [
"billing_address_id"
],
"columnNames": ["billing_address_id"],
"localTableName": "public.cart",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.cart_address",
"deleteRule": "set null",
"updateRule": "cascade"
@@ -705,9 +671,7 @@
"indexes": [
{
"keyName": "IDX_line_item_cart_id",
"columnNames": [
"cart_id"
],
"columnNames": ["cart_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -715,9 +679,7 @@
},
{
"keyName": "IDX_line_item_variant_id",
"columnNames": [
"variant_id"
],
"columnNames": ["variant_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -725,9 +687,7 @@
},
{
"keyName": "IDX_line_item_product_id",
"columnNames": [
"product_id"
],
"columnNames": ["product_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -735,9 +695,7 @@
},
{
"keyName": "IDX_cart_line_item_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -745,9 +703,7 @@
},
{
"keyName": "cart_line_item_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -757,13 +713,9 @@
"foreignKeys": {
"cart_line_item_cart_id_foreign": {
"constraintName": "cart_line_item_cart_id_foreign",
"columnNames": [
"cart_id"
],
"columnNames": ["cart_id"],
"localTableName": "public.cart_line_item",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.cart",
"updateRule": "cascade"
}
@@ -890,9 +842,7 @@
"indexes": [
{
"keyName": "IDX_adjustment_item_id",
"columnNames": [
"item_id"
],
"columnNames": ["item_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -900,9 +850,7 @@
},
{
"keyName": "IDX_line_item_adjustment_promotion_id",
"columnNames": [
"promotion_id"
],
"columnNames": ["promotion_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -910,9 +858,7 @@
},
{
"keyName": "IDX_cart_line_item_adjustment_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -920,9 +866,7 @@
},
{
"keyName": "cart_line_item_adjustment_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -1049,9 +993,7 @@
"indexes": [
{
"keyName": "IDX_tax_line_item_id",
"columnNames": [
"item_id"
],
"columnNames": ["item_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -1059,9 +1001,7 @@
},
{
"keyName": "IDX_line_item_tax_line_tax_rate_id",
"columnNames": [
"tax_rate_id"
],
"columnNames": ["tax_rate_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -1069,9 +1009,7 @@
},
{
"keyName": "IDX_cart_line_item_tax_line_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -1079,9 +1017,7 @@
},
{
"keyName": "cart_line_item_tax_line_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -1221,9 +1157,7 @@
"indexes": [
{
"keyName": "IDX_shipping_method_cart_id",
"columnNames": [
"cart_id"
],
"columnNames": ["cart_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -1231,9 +1165,7 @@
},
{
"keyName": "IDX_shipping_method_option_id",
"columnNames": [
"shipping_option_id"
],
"columnNames": ["shipping_option_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -1241,9 +1173,7 @@
},
{
"keyName": "IDX_cart_shipping_method_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -1251,9 +1181,7 @@
},
{
"keyName": "cart_shipping_method_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -1269,13 +1197,9 @@
"foreignKeys": {
"cart_shipping_method_cart_id_foreign": {
"constraintName": "cart_shipping_method_cart_id_foreign",
"columnNames": [
"cart_id"
],
"columnNames": ["cart_id"],
"localTableName": "public.cart_shipping_method",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.cart",
"updateRule": "cascade"
}
@@ -1402,9 +1326,7 @@
"indexes": [
{
"keyName": "IDX_adjustment_shipping_method_id",
"columnNames": [
"shipping_method_id"
],
"columnNames": ["shipping_method_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -1412,9 +1334,7 @@
},
{
"keyName": "IDX_shipping_method_adjustment_promotion_id",
"columnNames": [
"promotion_id"
],
"columnNames": ["promotion_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -1422,9 +1342,7 @@
},
{
"keyName": "IDX_cart_shipping_method_adjustment_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -1432,9 +1350,7 @@
},
{
"keyName": "cart_shipping_method_adjustment_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -1555,9 +1471,7 @@
"indexes": [
{
"keyName": "IDX_tax_line_shipping_method_id",
"columnNames": [
"shipping_method_id"
],
"columnNames": ["shipping_method_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -1565,9 +1479,7 @@
},
{
"keyName": "IDX_shipping_method_tax_line_tax_rate_id",
"columnNames": [
"tax_rate_id"
],
"columnNames": ["tax_rate_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -1575,9 +1487,7 @@
},
{
"keyName": "IDX_cart_shipping_method_tax_line_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -1585,9 +1495,7 @@
},
{
"keyName": "cart_shipping_method_tax_line_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -1597,4 +1505,4 @@
"foreignKeys": {}
}
]
}
}
+1 -1
View File
@@ -1,7 +1,7 @@
import { DAL } from "@medusajs/framework/types"
import {
DALUtils,
createPsqlIndexStatementHelper,
DALUtils,
generateEntityId,
} from "@medusajs/framework/utils"
import {
+2 -2
View File
@@ -1,7 +1,7 @@
import { DAL } from "@medusajs/framework/types"
import {
DALUtils,
createPsqlIndexStatementHelper,
DALUtils,
generateEntityId,
} from "@medusajs/framework/utils"
import {
@@ -11,8 +11,8 @@ import {
Entity,
Filter,
ManyToOne,
OnInit,
OneToMany,
OnInit,
OptionalProps,
PrimaryKey,
Property,
@@ -6,4 +6,3 @@ export { default as LineItemTaxLine } from "./line-item-tax-line"
export { default as ShippingMethod } from "./shipping-method"
export { default as ShippingMethodAdjustment } from "./shipping-method-adjustment"
export { default as ShippingMethodTaxLine } from "./shipping-method-tax-line"
@@ -1,6 +1,6 @@
import {
DALUtils,
createPsqlIndexStatementHelper,
DALUtils,
generateEntityId,
} from "@medusajs/framework/utils"
import {
@@ -1,6 +1,6 @@
import {
DALUtils,
createPsqlIndexStatementHelper,
DALUtils,
generateEntityId,
} from "@medusajs/framework/utils"
import {
@@ -1,10 +1,10 @@
import { BigNumberRawValue, DAL } from "@medusajs/framework/types"
import {
BigNumber,
DALUtils,
MikroOrmBigNumberProperty,
createPsqlIndexStatementHelper,
DALUtils,
generateEntityId,
MikroOrmBigNumberProperty,
} from "@medusajs/framework/utils"
import {
BeforeCreate,
@@ -13,8 +13,8 @@ import {
Entity,
Filter,
ManyToOne,
OnInit,
OneToMany,
OnInit,
OptionalProps,
PrimaryKey,
Property,
@@ -1,6 +1,6 @@
import {
DALUtils,
createPsqlIndexStatementHelper,
DALUtils,
generateEntityId,
} from "@medusajs/framework/utils"
import {
@@ -1,6 +1,6 @@
import {
DALUtils,
createPsqlIndexStatementHelper,
DALUtils,
generateEntityId,
} from "@medusajs/framework/utils"
import {
@@ -1,10 +1,10 @@
import { BigNumberRawValue, DAL } from "@medusajs/framework/types"
import {
BigNumber,
DALUtils,
MikroOrmBigNumberProperty,
createPsqlIndexStatementHelper,
DALUtils,
generateEntityId,
MikroOrmBigNumberProperty,
} from "@medusajs/framework/utils"
import {
BeforeCreate,
@@ -14,8 +14,8 @@ import {
Entity,
Filter,
ManyToOne,
OnInit,
OneToMany,
OnInit,
OptionalProps,
PrimaryKey,
Property,
+1 -1
View File
@@ -1 +1 @@
export { default as CartModuleService } from "./cart-module";
export { default as CartModuleService } from "./cart-module"
@@ -1,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -134,9 +132,7 @@
},
{
"keyName": "customer_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -320,9 +316,7 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"customer_id"
],
"columnNames": ["customer_id"],
"composite": false,
"keyName": "IDX_customer_address_customer_id",
"primary": false,
@@ -346,9 +340,7 @@
},
{
"keyName": "customer_address_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -358,13 +350,9 @@
"foreignKeys": {
"customer_address_customer_id_foreign": {
"constraintName": "customer_address_customer_id_foreign",
"columnNames": [
"customer_id"
],
"columnNames": ["customer_id"],
"localTableName": "public.customer_address",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.customer",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -447,9 +435,7 @@
"indexes": [
{
"keyName": "IDX_customer_group_name_unique",
"columnNames": [
"name"
],
"columnNames": ["name"],
"composite": false,
"primary": false,
"unique": false,
@@ -457,9 +443,7 @@
},
{
"keyName": "customer_group_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -542,18 +526,14 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"customer_group_id"
],
"columnNames": ["customer_group_id"],
"composite": false,
"keyName": "IDX_customer_group_customer_group_id",
"primary": false,
"unique": false
},
{
"columnNames": [
"customer_id"
],
"columnNames": ["customer_id"],
"composite": false,
"keyName": "IDX_customer_group_customer_customer_id",
"primary": false,
@@ -561,9 +541,7 @@
},
{
"keyName": "customer_group_customer_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -573,25 +551,17 @@
"foreignKeys": {
"customer_group_customer_customer_group_id_foreign": {
"constraintName": "customer_group_customer_customer_group_id_foreign",
"columnNames": [
"customer_group_id"
],
"columnNames": ["customer_group_id"],
"localTableName": "public.customer_group_customer",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.customer_group",
"deleteRule": "cascade"
},
"customer_group_customer_customer_id_foreign": {
"constraintName": "customer_group_customer_customer_id_foreign",
"columnNames": [
"customer_id"
],
"columnNames": ["customer_id"],
"localTableName": "public.customer_group_customer",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.customer",
"deleteRule": "cascade"
}
@@ -1,21 +1,39 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@mikro-orm/migrations"
export class Migration20240524123112 extends Migration {
async up(): Promise<void> {
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_email_has_account_unique" ON "customer" (email, has_account) WHERE deleted_at IS NULL;');
this.addSql(
'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_email_has_account_unique" ON "customer" (email, has_account) WHERE deleted_at IS NULL;'
)
this.addSql('drop index if exists "IDX_customer_address_unqiue_customer_billing";');
this.addSql('drop index if exists "IDX_customer_address_unqiue_customer_shipping";');
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_address_unique_customer_billing" ON "customer_address" (customer_id) WHERE "is_default_billing" = true;');
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_address_unique_customer_shipping" ON "customer_address" (customer_id) WHERE "is_default_shipping" = true;');
this.addSql(
'drop index if exists "IDX_customer_address_unqiue_customer_billing";'
)
this.addSql(
'drop index if exists "IDX_customer_address_unqiue_customer_shipping";'
)
this.addSql(
'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_address_unique_customer_billing" ON "customer_address" (customer_id) WHERE "is_default_billing" = true;'
)
this.addSql(
'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_customer_address_unique_customer_shipping" ON "customer_address" (customer_id) WHERE "is_default_shipping" = true;'
)
}
async down(): Promise<void> {
this.addSql('drop index if exists "IDX_customer_email_has_account_unique";');
this.addSql('drop index if exists "IDX_customer_email_has_account_unique";')
this.addSql('drop index if exists "IDX_customer_address_unique_customer_billing";');
this.addSql('drop index if exists "IDX_customer_address_unique_customer_shipping";');
this.addSql('create unique index if not exists "IDX_customer_address_unqiue_customer_billing" on "customer_address" ("customer_id") where "is_default_billing" = true;');
this.addSql('create unique index if not exists "IDX_customer_address_unique_customer_shipping" on "customer_address" ("customer_id") where "is_default_shipping" = true;');
this.addSql(
'drop index if exists "IDX_customer_address_unique_customer_billing";'
)
this.addSql(
'drop index if exists "IDX_customer_address_unique_customer_shipping";'
)
this.addSql(
'create unique index if not exists "IDX_customer_address_unqiue_customer_billing" on "customer_address" ("customer_id") where "is_default_billing" = true;'
)
this.addSql(
'create unique index if not exists "IDX_customer_address_unique_customer_shipping" on "customer_address" ("customer_id") where "is_default_shipping" = true;'
)
}
}
+3 -3
View File
@@ -38,7 +38,7 @@ An open source composable commerce engine built for developers.
Local Event Bus module for Medusa. When installed, the events system of Medusa is powered by the Node EventEmitter. This module installed by default in new (> v1.8.0) Medusa projects.
The Node EventEmitter is limited to a single process environment. We generally recommend using the `@medusajs/event-bus-redis` module in a production environment.
The Node EventEmitter is limited to a single process environment. We generally recommend using the `@medusajs/event-bus-redis` module in a production environment.
## Getting started
@@ -48,7 +48,7 @@ Install the module:
yarn add @medusajs/event-bus-local
```
You don't need to add the module to your project configuration as it is the default one. Medusa will try to use it, if no other event buses are installed.
You don't need to add the module to your project configuration as it is the default one. Medusa will try to use it, if no other event buses are installed.
```js
module.exports = {
@@ -60,4 +60,4 @@ module.exports = {
## Configuration
The module comes with no configuration options.
The module comes with no configuration options.
+8 -8
View File
@@ -55,7 +55,7 @@ module.exports = {
{
resolve: "@medusajs/event-bus-redis",
options: {
redisUrl: "redis:.."
redisUrl: "redis:..",
},
},
],
@@ -67,13 +67,13 @@ module.exports = {
The module can be configured with the following options:
| Option | Type | Description | Default |
| --------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| `redisUrl` | `string` | URL of the Redis instance to connect to. | `events-worker` |
| `queueName` | `string?` | Name of the BullMQ queue. | `events-queue` |
| `queueOptions` | `object?` | Options for the BullMQ queue. See BullMQ's [documentation](https://api.docs.bullmq.io/interfaces/QueueOptions.html). | `{}` |
| `redisOptions` | `object?` | Options for the Redis instance. See `io-redis`'s [documentation](https://luin.github.io/ioredis/index.html#RedisOptions) | `{}` |
| Option | Type | Description | Default |
| -------------- | --------- | ------------------------------------------------------------------------------------------------------------------------ | --------------- |
| `redisUrl` | `string` | URL of the Redis instance to connect to. | `events-worker` |
| `queueName` | `string?` | Name of the BullMQ queue. | `events-queue` |
| `queueOptions` | `object?` | Options for the BullMQ queue. See BullMQ's [documentation](https://api.docs.bullmq.io/interfaces/QueueOptions.html). | `{}` |
| `redisOptions` | `object?` | Options for the Redis instance. See `io-redis`'s [documentation](https://luin.github.io/ioredis/index.html#RedisOptions) | `{}` |
**Info**: See how the options are applied in the [RedisEventBusService](https://github.com/medusajs/medusa/blob/0c1d1d590463fa30b083c4312293348bdf6596be/packages/event-bus-redis/src/services/event-bus-redis.ts#L52) and [loader](https://github.com/medusajs/medusa/blob/0c1d1d590463fa30b083c4312293348bdf6596be/packages/event-bus-redis/src/loaders/index.ts).
If you do not provide a `redisUrl` in the module options, the server will fail to start.
If you do not provide a `redisUrl` in the module options, the server will fail to start.
@@ -9,7 +9,7 @@ import {
FileProviderIdentifierRegistrationName,
FileProviderRegistrationPrefix,
} from "@types"
import { Lifetime, asFunction, asValue } from "awilix"
import { asFunction, asValue, Lifetime } from "awilix"
const registrationFn = async (klass, container, pluginOptions) => {
const key = FileProviderService.getRegistrationIdentifier(
@@ -1,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -152,9 +150,7 @@
"indexes": [
{
"keyName": "IDX_fulfillment_address_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -162,9 +158,7 @@
},
{
"keyName": "fulfillment_address_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -200,9 +194,7 @@
"indexes": [
{
"keyName": "fulfillment_provider_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -287,9 +279,7 @@
"indexes": [
{
"keyName": "IDX_fulfillment_set_name_unique",
"columnNames": [
"name"
],
"columnNames": ["name"],
"composite": false,
"primary": false,
"unique": false,
@@ -297,9 +287,7 @@
},
{
"keyName": "IDX_fulfillment_set_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -307,9 +295,7 @@
},
{
"keyName": "fulfillment_set_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -394,9 +380,7 @@
"indexes": [
{
"keyName": "IDX_service_zone_name_unique",
"columnNames": [
"name"
],
"columnNames": ["name"],
"composite": false,
"primary": false,
"unique": false,
@@ -404,9 +388,7 @@
},
{
"keyName": "IDX_service_zone_fulfillment_set_id",
"columnNames": [
"fulfillment_set_id"
],
"columnNames": ["fulfillment_set_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -414,9 +396,7 @@
},
{
"keyName": "IDX_service_zone_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -424,9 +404,7 @@
},
{
"keyName": "service_zone_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -436,13 +414,9 @@
"foreignKeys": {
"service_zone_fulfillment_set_id_foreign": {
"constraintName": "service_zone_fulfillment_set_id_foreign",
"columnNames": [
"fulfillment_set_id"
],
"columnNames": ["fulfillment_set_id"],
"localTableName": "public.service_zone",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.fulfillment_set",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -468,12 +442,7 @@
"primary": false,
"nullable": false,
"default": "'country'",
"enumItems": [
"country",
"province",
"city",
"zip"
],
"enumItems": ["country", "province", "city", "zip"],
"mappedType": "enum"
},
"country_code": {
@@ -568,9 +537,7 @@
"indexes": [
{
"keyName": "IDX_geo_zone_country_code",
"columnNames": [
"country_code"
],
"columnNames": ["country_code"],
"composite": false,
"primary": false,
"unique": false,
@@ -578,9 +545,7 @@
},
{
"keyName": "IDX_geo_zone_province_code",
"columnNames": [
"province_code"
],
"columnNames": ["province_code"],
"composite": false,
"primary": false,
"unique": false,
@@ -588,9 +553,7 @@
},
{
"keyName": "IDX_geo_zone_city",
"columnNames": [
"city"
],
"columnNames": ["city"],
"composite": false,
"primary": false,
"unique": false,
@@ -598,9 +561,7 @@
},
{
"keyName": "IDX_geo_zone_service_zone_id",
"columnNames": [
"service_zone_id"
],
"columnNames": ["service_zone_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -608,9 +569,7 @@
},
{
"keyName": "IDX_geo_zone_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -618,9 +577,7 @@
},
{
"keyName": "geo_zone_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -630,13 +587,9 @@
"foreignKeys": {
"geo_zone_service_zone_id_foreign": {
"constraintName": "geo_zone_service_zone_id_foreign",
"columnNames": [
"service_zone_id"
],
"columnNames": ["service_zone_id"],
"localTableName": "public.geo_zone",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.service_zone",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -719,9 +672,7 @@
"indexes": [
{
"keyName": "IDX_shipping_option_type_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -729,9 +680,7 @@
},
{
"keyName": "shipping_option_type_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -816,9 +765,7 @@
"indexes": [
{
"keyName": "IDX_shipping_profile_name_unique",
"columnNames": [
"name"
],
"columnNames": ["name"],
"composite": false,
"primary": false,
"unique": false,
@@ -826,9 +773,7 @@
},
{
"keyName": "IDX_shipping_profile_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -836,9 +781,7 @@
},
{
"keyName": "shipping_profile_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -875,10 +818,7 @@
"primary": false,
"nullable": false,
"default": "'flat'",
"enumItems": [
"calculated",
"flat"
],
"enumItems": ["calculated", "flat"],
"mappedType": "enum"
},
"service_zone_id": {
@@ -972,9 +912,7 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"shipping_option_type_id"
],
"columnNames": ["shipping_option_type_id"],
"composite": false,
"keyName": "shipping_option_shipping_option_type_id_unique",
"primary": false,
@@ -982,9 +920,7 @@
},
{
"keyName": "IDX_shipping_option_service_zone_id",
"columnNames": [
"service_zone_id"
],
"columnNames": ["service_zone_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -992,9 +928,7 @@
},
{
"keyName": "IDX_shipping_option_shipping_profile_id",
"columnNames": [
"shipping_profile_id"
],
"columnNames": ["shipping_profile_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -1002,9 +936,7 @@
},
{
"keyName": "IDX_shipping_option_provider_id",
"columnNames": [
"provider_id"
],
"columnNames": ["provider_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -1012,9 +944,7 @@
},
{
"keyName": "IDX_shipping_option_shipping_option_type_id",
"columnNames": [
"shipping_option_type_id"
],
"columnNames": ["shipping_option_type_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -1022,9 +952,7 @@
},
{
"keyName": "IDX_shipping_option_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -1032,9 +960,7 @@
},
{
"keyName": "shipping_option_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -1044,52 +970,36 @@
"foreignKeys": {
"shipping_option_service_zone_id_foreign": {
"constraintName": "shipping_option_service_zone_id_foreign",
"columnNames": [
"service_zone_id"
],
"columnNames": ["service_zone_id"],
"localTableName": "public.shipping_option",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.service_zone",
"deleteRule": "cascade",
"updateRule": "cascade"
},
"shipping_option_shipping_profile_id_foreign": {
"constraintName": "shipping_option_shipping_profile_id_foreign",
"columnNames": [
"shipping_profile_id"
],
"columnNames": ["shipping_profile_id"],
"localTableName": "public.shipping_option",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.shipping_profile",
"deleteRule": "set null",
"updateRule": "cascade"
},
"shipping_option_provider_id_foreign": {
"constraintName": "shipping_option_provider_id_foreign",
"columnNames": [
"provider_id"
],
"columnNames": ["provider_id"],
"localTableName": "public.shipping_option",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.fulfillment_provider",
"deleteRule": "set null",
"updateRule": "cascade"
},
"shipping_option_shipping_option_type_id_foreign": {
"constraintName": "shipping_option_shipping_option_type_id_foreign",
"columnNames": [
"shipping_option_type_id"
],
"columnNames": ["shipping_option_type_id"],
"localTableName": "public.shipping_option",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.shipping_option_type",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -1123,16 +1033,7 @@
"autoincrement": false,
"primary": false,
"nullable": false,
"enumItems": [
"in",
"eq",
"ne",
"gt",
"gte",
"lt",
"lte",
"nin"
],
"enumItems": ["in", "eq", "ne", "gt", "gte", "lt", "lte", "nin"],
"mappedType": "enum"
},
"value": {
@@ -1191,9 +1092,7 @@
"indexes": [
{
"keyName": "IDX_shipping_option_rule_shipping_option_id",
"columnNames": [
"shipping_option_id"
],
"columnNames": ["shipping_option_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -1201,9 +1100,7 @@
},
{
"keyName": "IDX_shipping_option_rule_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -1211,9 +1108,7 @@
},
{
"keyName": "shipping_option_rule_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -1223,13 +1118,9 @@
"foreignKeys": {
"shipping_option_rule_shipping_option_id_foreign": {
"constraintName": "shipping_option_rule_shipping_option_id_foreign",
"columnNames": [
"shipping_option_id"
],
"columnNames": ["shipping_option_id"],
"localTableName": "public.shipping_option_rule",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.shipping_option",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -1406,9 +1297,7 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"delivery_address_id"
],
"columnNames": ["delivery_address_id"],
"composite": false,
"keyName": "fulfillment_delivery_address_id_unique",
"primary": false,
@@ -1416,9 +1305,7 @@
},
{
"keyName": "IDX_fulfillment_location_id",
"columnNames": [
"location_id"
],
"columnNames": ["location_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -1426,9 +1313,7 @@
},
{
"keyName": "IDX_fulfillment_provider_id",
"columnNames": [
"provider_id"
],
"columnNames": ["provider_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -1436,9 +1321,7 @@
},
{
"keyName": "IDX_fulfillment_shipping_option_id",
"columnNames": [
"shipping_option_id"
],
"columnNames": ["shipping_option_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -1446,9 +1329,7 @@
},
{
"keyName": "IDX_fulfillment_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -1456,9 +1337,7 @@
},
{
"keyName": "fulfillment_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -1468,39 +1347,27 @@
"foreignKeys": {
"fulfillment_provider_id_foreign": {
"constraintName": "fulfillment_provider_id_foreign",
"columnNames": [
"provider_id"
],
"columnNames": ["provider_id"],
"localTableName": "public.fulfillment",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.fulfillment_provider",
"deleteRule": "set null",
"updateRule": "cascade"
},
"fulfillment_shipping_option_id_foreign": {
"constraintName": "fulfillment_shipping_option_id_foreign",
"columnNames": [
"shipping_option_id"
],
"columnNames": ["shipping_option_id"],
"localTableName": "public.fulfillment",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.shipping_option",
"deleteRule": "set null",
"updateRule": "cascade"
},
"fulfillment_delivery_address_id_foreign": {
"constraintName": "fulfillment_delivery_address_id_foreign",
"columnNames": [
"delivery_address_id"
],
"columnNames": ["delivery_address_id"],
"localTableName": "public.fulfillment",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.fulfillment_address",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -1592,9 +1459,7 @@
"indexes": [
{
"keyName": "IDX_fulfillment_label_fulfillment_id",
"columnNames": [
"fulfillment_id"
],
"columnNames": ["fulfillment_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -1602,9 +1467,7 @@
},
{
"keyName": "IDX_fulfillment_label_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -1612,9 +1475,7 @@
},
{
"keyName": "fulfillment_label_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -1624,13 +1485,9 @@
"foreignKeys": {
"fulfillment_label_fulfillment_id_foreign": {
"constraintName": "fulfillment_label_fulfillment_id_foreign",
"columnNames": [
"fulfillment_id"
],
"columnNames": ["fulfillment_id"],
"localTableName": "public.fulfillment_label",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.fulfillment",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -1758,9 +1615,7 @@
"indexes": [
{
"keyName": "IDX_fulfillment_item_line_item_id",
"columnNames": [
"line_item_id"
],
"columnNames": ["line_item_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -1768,9 +1623,7 @@
},
{
"keyName": "IDX_fulfillment_item_inventory_item_id",
"columnNames": [
"inventory_item_id"
],
"columnNames": ["inventory_item_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -1778,9 +1631,7 @@
},
{
"keyName": "IDX_fulfillment_item_fulfillment_id",
"columnNames": [
"fulfillment_id"
],
"columnNames": ["fulfillment_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -1788,9 +1639,7 @@
},
{
"keyName": "IDX_fulfillment_item_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -1798,9 +1647,7 @@
},
{
"keyName": "fulfillment_item_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -1810,13 +1657,9 @@
"foreignKeys": {
"fulfillment_item_fulfillment_id_foreign": {
"constraintName": "fulfillment_item_fulfillment_id_foreign",
"columnNames": [
"fulfillment_id"
],
"columnNames": ["fulfillment_id"],
"localTableName": "public.fulfillment_item",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.fulfillment",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -1,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -180,9 +178,7 @@
"indexes": [
{
"keyName": "IDX_inventory_item_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -190,9 +186,7 @@
},
{
"keyName": "IDX_inventory_item_sku_unique",
"columnNames": [
"sku"
],
"columnNames": ["sku"],
"composite": false,
"primary": false,
"unique": false,
@@ -200,9 +194,7 @@
},
{
"keyName": "inventory_item_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -317,9 +309,7 @@
"indexes": [
{
"keyName": "IDX_inventory_level_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -327,9 +317,7 @@
},
{
"keyName": "IDX_inventory_level_inventory_item_id",
"columnNames": [
"inventory_item_id"
],
"columnNames": ["inventory_item_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -337,9 +325,7 @@
},
{
"keyName": "IDX_inventory_level_location_id",
"columnNames": [
"location_id"
],
"columnNames": ["location_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -355,9 +341,7 @@
},
{
"keyName": "inventory_level_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -367,13 +351,9 @@
"foreignKeys": {
"inventory_level_inventory_item_id_foreign": {
"constraintName": "inventory_level_inventory_item_id_foreign",
"columnNames": [
"inventory_item_id"
],
"columnNames": ["inventory_item_id"],
"localTableName": "public.inventory_level",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.inventory_item",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -501,9 +481,7 @@
"indexes": [
{
"keyName": "IDX_reservation_item_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -511,9 +489,7 @@
},
{
"keyName": "IDX_reservation_item_line_item_id",
"columnNames": [
"line_item_id"
],
"columnNames": ["line_item_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -521,9 +497,7 @@
},
{
"keyName": "IDX_reservation_item_location_id",
"columnNames": [
"location_id"
],
"columnNames": ["location_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -531,9 +505,7 @@
},
{
"keyName": "IDX_reservation_item_inventory_item_id",
"columnNames": [
"inventory_item_id"
],
"columnNames": ["inventory_item_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -541,9 +513,7 @@
},
{
"keyName": "reservation_item_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -553,13 +523,9 @@
"foreignKeys": {
"reservation_item_inventory_item_id_foreign": {
"constraintName": "reservation_item_inventory_item_id_foreign",
"columnNames": [
"inventory_item_id"
],
"columnNames": ["inventory_item_id"],
"localTableName": "public.reservation_item",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.inventory_item",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -1,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -91,9 +89,7 @@
"indexes": [
{
"keyName": "notification_provider_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -220,11 +216,7 @@
"primary": false,
"nullable": false,
"default": "'pending'",
"enumItems": [
"pending",
"success",
"failure"
],
"enumItems": ["pending", "success", "failure"],
"mappedType": "enum"
},
"provider_id": {
@@ -298,9 +290,7 @@
},
{
"keyName": "notification_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -310,13 +300,9 @@
"foreignKeys": {
"notification_provider_id_foreign": {
"constraintName": "notification_provider_id_foreign",
"columnNames": [
"provider_id"
],
"columnNames": ["provider_id"],
"localTableName": "public.notification",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.notification_provider",
"deleteRule": "set null",
"updateRule": "cascade"
@@ -1,13 +1,15 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@mikro-orm/migrations"
export class Migration20240830094712 extends Migration {
async up(): Promise<void> {
this.addSql('alter table if exists "notification" add column if not exists "status" text check ("status" in (\'pending\', \'success\', \'failure\')) not null default \'pending\';');
this.addSql(
"alter table if exists \"notification\" add column if not exists \"status\" text check (\"status\" in ('pending', 'success', 'failure')) not null default 'pending';"
)
}
async down(): Promise<void> {
this.addSql('alter table if exists "notification" drop column if exists "status";');
this.addSql(
'alter table if exists "notification" drop column if exists "status";'
)
}
}
File diff suppressed because it is too large Load Diff
@@ -1,17 +1,23 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@mikro-orm/migrations"
export class Migration20240902195921 extends Migration {
async up(): Promise<void> {
this.addSql('alter table if exists "order_line_item" add column if not exists "is_custom_price" boolean not null default false;');
this.addSql(
'alter table if exists "order_line_item" add column if not exists "is_custom_price" boolean not null default false;'
)
this.addSql('alter table if exists "order_shipping_method" add column if not exists "is_custom_amount" boolean not null default false;');
this.addSql(
'alter table if exists "order_shipping_method" add column if not exists "is_custom_amount" boolean not null default false;'
)
}
async down(): Promise<void> {
this.addSql('alter table if exists "order_line_item" drop column if exists "is_custom_price";');
this.addSql(
'alter table if exists "order_line_item" drop column if exists "is_custom_price";'
)
this.addSql('alter table if exists "order_shipping_method" drop column if exists "is_custom_amount";');
this.addSql(
'alter table if exists "order_shipping_method" drop column if exists "is_custom_amount";'
)
}
}
@@ -1,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -178,18 +176,14 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"region_id"
],
"columnNames": ["region_id"],
"composite": false,
"keyName": "IDX_payment_collection_region_id",
"primary": false,
"unique": false
},
{
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"keyName": "IDX_payment_collection_deleted_at",
"primary": false,
@@ -197,9 +191,7 @@
},
{
"keyName": "payment_collection_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -310,9 +302,7 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"keyName": "IDX_payment_method_token_deleted_at",
"primary": false,
@@ -320,9 +310,7 @@
},
{
"keyName": "payment_method_token_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -358,9 +346,7 @@
"indexes": [
{
"keyName": "payment_provider_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -395,10 +381,7 @@
"indexes": [
{
"keyName": "payment_collection_payment_providers_pkey",
"columnNames": [
"payment_collection_id",
"payment_provider_id"
],
"columnNames": ["payment_collection_id", "payment_provider_id"],
"composite": true,
"primary": true,
"unique": true
@@ -408,26 +391,18 @@
"foreignKeys": {
"payment_collection_payment_providers_payment_coll_aa276_foreign": {
"constraintName": "payment_collection_payment_providers_payment_coll_aa276_foreign",
"columnNames": [
"payment_collection_id"
],
"columnNames": ["payment_collection_id"],
"localTableName": "public.payment_collection_payment_providers",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.payment_collection",
"deleteRule": "cascade",
"updateRule": "cascade"
},
"payment_collection_payment_providers_payment_provider_id_foreign": {
"constraintName": "payment_collection_payment_providers_payment_provider_id_foreign",
"columnNames": [
"payment_provider_id"
],
"columnNames": ["payment_provider_id"],
"localTableName": "public.payment_collection_payment_providers",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.payment_provider",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -582,18 +557,14 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"payment_collection_id"
],
"columnNames": ["payment_collection_id"],
"composite": false,
"keyName": "IDX_payment_session_payment_collection_id",
"primary": false,
"unique": false
},
{
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"keyName": "IDX_payment_session_deleted_at",
"primary": false,
@@ -601,9 +572,7 @@
},
{
"keyName": "payment_session_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -613,13 +582,9 @@
"foreignKeys": {
"payment_session_payment_collection_id_foreign": {
"constraintName": "payment_session_payment_collection_id_foreign",
"columnNames": [
"payment_collection_id"
],
"columnNames": ["payment_collection_id"],
"localTableName": "public.payment_session",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.payment_collection",
"updateRule": "cascade"
}
@@ -792,36 +757,28 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"keyName": "IDX_payment_deleted_at",
"primary": false,
"unique": false
},
{
"columnNames": [
"payment_collection_id"
],
"columnNames": ["payment_collection_id"],
"composite": false,
"keyName": "IDX_payment_payment_collection_id",
"primary": false,
"unique": false
},
{
"columnNames": [
"payment_session_id"
],
"columnNames": ["payment_session_id"],
"composite": false,
"keyName": "IDX_payment_payment_session_id",
"primary": false,
"unique": false
},
{
"columnNames": [
"payment_session_id"
],
"columnNames": ["payment_session_id"],
"composite": false,
"keyName": "payment_payment_session_id_unique",
"primary": false,
@@ -829,9 +786,7 @@
},
{
"keyName": "IDX_payment_provider_id",
"columnNames": [
"provider_id"
],
"columnNames": ["provider_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -839,9 +794,7 @@
},
{
"keyName": "payment_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -851,25 +804,17 @@
"foreignKeys": {
"payment_payment_collection_id_foreign": {
"constraintName": "payment_payment_collection_id_foreign",
"columnNames": [
"payment_collection_id"
],
"columnNames": ["payment_collection_id"],
"localTableName": "public.payment",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.payment_collection",
"updateRule": "cascade"
},
"payment_payment_session_id_foreign": {
"constraintName": "payment_payment_session_id_foreign",
"columnNames": [
"payment_session_id"
],
"columnNames": ["payment_session_id"],
"localTableName": "public.payment",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.payment_session",
"updateRule": "cascade"
}
@@ -968,18 +913,14 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"payment_id"
],
"columnNames": ["payment_id"],
"composite": false,
"keyName": "IDX_capture_payment_id",
"primary": false,
"unique": false
},
{
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"keyName": "IDX_capture_deleted_at",
"primary": false,
@@ -987,9 +928,7 @@
},
{
"keyName": "capture_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -999,13 +938,9 @@
"foreignKeys": {
"capture_payment_id_foreign": {
"constraintName": "capture_payment_id_foreign",
"columnNames": [
"payment_id"
],
"columnNames": ["payment_id"],
"localTableName": "public.capture",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.payment",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -1088,9 +1023,7 @@
"indexes": [
{
"keyName": "refund_reason_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -1210,18 +1143,14 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"payment_id"
],
"columnNames": ["payment_id"],
"composite": false,
"keyName": "IDX_refund_payment_id",
"primary": false,
"unique": false
},
{
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"keyName": "IDX_refund_deleted_at",
"primary": false,
@@ -1229,9 +1158,7 @@
},
{
"keyName": "refund_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -1241,26 +1168,18 @@
"foreignKeys": {
"refund_payment_id_foreign": {
"constraintName": "refund_payment_id_foreign",
"columnNames": [
"payment_id"
],
"columnNames": ["payment_id"],
"localTableName": "public.refund",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.payment",
"deleteRule": "cascade",
"updateRule": "cascade"
},
"refund_refund_reason_id_foreign": {
"constraintName": "refund_refund_reason_id_foreign",
"columnNames": [
"refund_reason_id"
],
"columnNames": ["refund_reason_id"],
"localTableName": "public.refund",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.refund_reason",
"deleteRule": "set null",
"updateRule": "cascade"
@@ -1,3 +1,2 @@
export { default as PaymentModuleService } from "./payment-module"
export { default as PaymentProviderService } from "./payment-provider"
@@ -1,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -41,10 +39,7 @@
"primary": false,
"nullable": false,
"default": "'draft'",
"enumItems": [
"active",
"draft"
],
"enumItems": ["active", "draft"],
"mappedType": "enum"
},
"type": {
@@ -55,10 +50,7 @@
"primary": false,
"nullable": false,
"default": "'sale'",
"enumItems": [
"sale",
"override"
],
"enumItems": ["sale", "override"],
"mappedType": "enum"
},
"starts_at": {
@@ -129,9 +121,7 @@
"indexes": [
{
"keyName": "IDX_price_list_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -139,9 +129,7 @@
},
{
"keyName": "price_list_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -226,9 +214,7 @@
"indexes": [
{
"keyName": "IDX_price_list_rule_price_list_id",
"columnNames": [
"price_list_id"
],
"columnNames": ["price_list_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -236,9 +222,7 @@
},
{
"keyName": "IDX_price_list_rule_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -246,9 +230,7 @@
},
{
"keyName": "price_list_rule_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -258,13 +240,9 @@
"foreignKeys": {
"price_list_rule_price_list_id_foreign": {
"constraintName": "price_list_rule_price_list_id_foreign",
"columnNames": [
"price_list_id"
],
"columnNames": ["price_list_id"],
"localTableName": "public.price_list_rule",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.price_list",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -348,9 +326,7 @@
"indexes": [
{
"keyName": "IDX_price_preference_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -366,9 +342,7 @@
},
{
"keyName": "price_preference_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -426,9 +400,7 @@
"indexes": [
{
"keyName": "IDX_price_set_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -436,9 +408,7 @@
},
{
"keyName": "price_set_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -578,9 +548,7 @@
"indexes": [
{
"keyName": "IDX_price_currency_code",
"columnNames": [
"currency_code"
],
"columnNames": ["currency_code"],
"composite": false,
"primary": false,
"unique": false,
@@ -588,9 +556,7 @@
},
{
"keyName": "IDX_price_price_set_id",
"columnNames": [
"price_set_id"
],
"columnNames": ["price_set_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -598,9 +564,7 @@
},
{
"keyName": "IDX_price_price_list_id",
"columnNames": [
"price_list_id"
],
"columnNames": ["price_list_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -608,9 +572,7 @@
},
{
"keyName": "IDX_price_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -618,9 +580,7 @@
},
{
"keyName": "price_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -630,26 +590,18 @@
"foreignKeys": {
"price_price_set_id_foreign": {
"constraintName": "price_price_set_id_foreign",
"columnNames": [
"price_set_id"
],
"columnNames": ["price_set_id"],
"localTableName": "public.price",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.price_set",
"deleteRule": "cascade",
"updateRule": "cascade"
},
"price_price_list_id_foreign": {
"constraintName": "price_price_list_id_foreign",
"columnNames": [
"price_list_id"
],
"columnNames": ["price_list_id"],
"localTableName": "public.price",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.price_list",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -742,9 +694,7 @@
"indexes": [
{
"keyName": "IDX_price_rule_price_id_attribute_unique",
"columnNames": [
"price_id"
],
"columnNames": ["price_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -752,9 +702,7 @@
},
{
"keyName": "IDX_price_rule_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -762,9 +710,7 @@
},
{
"keyName": "price_rule_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -774,13 +720,9 @@
"foreignKeys": {
"price_rule_price_id_foreign": {
"constraintName": "price_rule_price_id_foreign",
"columnNames": [
"price_id"
],
"columnNames": ["price_id"],
"localTableName": "public.price_rule",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.price",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -1,15 +1,19 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@mikro-orm/migrations"
export class Migration20240322094407 extends Migration {
async up(): Promise<void> {
this.addSql('drop table if exists "money_amount" cascade;');
this.addSql('drop table if exists "money_amount" cascade;')
}
async down(): Promise<void> {
this.addSql('create table if not exists "money_amount" ("id" text not null, "currency_code" text not null, "amount" numeric not null, "min_quantity" numeric null, "max_quantity" numeric null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "money_amount_pkey" primary key ("id"));');
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_money_amount_currency_code" ON "money_amount" (currency_code) WHERE deleted_at IS NULL;');
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_money_amount_deleted_at" ON "money_amount" (deleted_at) WHERE deleted_at IS NOT NULL;');
this.addSql(
'create table if not exists "money_amount" ("id" text not null, "currency_code" text not null, "amount" numeric not null, "min_quantity" numeric null, "max_quantity" numeric null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "money_amount_pkey" primary key ("id"));'
)
this.addSql(
'CREATE INDEX IF NOT EXISTS "IDX_money_amount_currency_code" ON "money_amount" (currency_code) WHERE deleted_at IS NULL;'
)
this.addSql(
'CREATE INDEX IF NOT EXISTS "IDX_money_amount_deleted_at" ON "money_amount" (deleted_at) WHERE deleted_at IS NOT NULL;'
)
}
}
@@ -1,15 +1,19 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@mikro-orm/migrations"
export class Migration20240704094505 extends Migration {
async up(): Promise<void> {
this.addSql('create table if not exists "price_preference" ("id" text not null, "attribute" text not null, "value" text null, "is_tax_inclusive" boolean not null default false, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "price_preference_pkey" primary key ("id"));');
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_preference_deleted_at" ON "price_preference" (deleted_at) WHERE deleted_at IS NOT NULL;');
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_price_preference_attribute_value" ON "price_preference" (attribute, value) WHERE deleted_at IS NULL;');
this.addSql(
'create table if not exists "price_preference" ("id" text not null, "attribute" text not null, "value" text null, "is_tax_inclusive" boolean not null default false, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "price_preference_pkey" primary key ("id"));'
)
this.addSql(
'CREATE INDEX IF NOT EXISTS "IDX_price_preference_deleted_at" ON "price_preference" (deleted_at) WHERE deleted_at IS NOT NULL;'
)
this.addSql(
'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_price_preference_attribute_value" ON "price_preference" (attribute, value) WHERE deleted_at IS NULL;'
)
}
async down(): Promise<void> {
this.addSql('drop table if exists "price_preference" cascade;');
this.addSql('drop table if exists "price_preference" cascade;')
}
}
@@ -1,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -128,9 +126,7 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"keyName": "IDX_product_category_deleted_at",
"primary": false,
@@ -138,9 +134,7 @@
},
{
"keyName": "product_category_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -150,13 +144,9 @@
"foreignKeys": {
"product_category_parent_category_id_foreign": {
"constraintName": "product_category_parent_category_id_foreign",
"columnNames": [
"parent_category_id"
],
"columnNames": ["parent_category_id"],
"localTableName": "public.product_category",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.product_category",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -238,9 +228,7 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"keyName": "IDX_product_collection_deleted_at",
"primary": false,
@@ -248,9 +236,7 @@
},
{
"keyName": "product_collection_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -325,9 +311,7 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"keyName": "IDX_product_image_deleted_at",
"primary": false,
@@ -335,9 +319,7 @@
},
{
"keyName": "image_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -412,9 +394,7 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"keyName": "IDX_product_tag_deleted_at",
"primary": false,
@@ -422,9 +402,7 @@
},
{
"keyName": "product_tag_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -499,9 +477,7 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"keyName": "IDX_product_type_deleted_at",
"primary": false,
@@ -509,9 +485,7 @@
},
{
"keyName": "product_type_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -584,12 +558,7 @@
"autoincrement": false,
"primary": false,
"nullable": false,
"enumItems": [
"draft",
"proposed",
"published",
"rejected"
],
"enumItems": ["draft", "proposed", "published", "rejected"],
"mappedType": "enum"
},
"thumbnail": {
@@ -756,9 +725,7 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"keyName": "IDX_product_deleted_at",
"primary": false,
@@ -766,9 +733,7 @@
},
{
"keyName": "product_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -778,26 +743,18 @@
"foreignKeys": {
"product_collection_id_foreign": {
"constraintName": "product_collection_id_foreign",
"columnNames": [
"collection_id"
],
"columnNames": ["collection_id"],
"localTableName": "public.product",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.product_collection",
"deleteRule": "set null",
"updateRule": "cascade"
},
"product_type_id_foreign": {
"constraintName": "product_type_id_foreign",
"columnNames": [
"type_id"
],
"columnNames": ["type_id"],
"localTableName": "public.product",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.product_type",
"deleteRule": "set null",
"updateRule": "cascade"
@@ -879,9 +836,7 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"keyName": "IDX_product_option_deleted_at",
"primary": false,
@@ -889,9 +844,7 @@
},
{
"keyName": "product_option_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -901,13 +854,9 @@
"foreignKeys": {
"product_option_product_id_foreign": {
"constraintName": "product_option_product_id_foreign",
"columnNames": [
"product_id"
],
"columnNames": ["product_id"],
"localTableName": "public.product_option",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.product",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -989,9 +938,7 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"keyName": "IDX_product_option_value_deleted_at",
"primary": false,
@@ -999,9 +946,7 @@
},
{
"keyName": "product_option_value_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -1011,13 +956,9 @@
"foreignKeys": {
"product_option_value_option_id_foreign": {
"constraintName": "product_option_value_option_id_foreign",
"columnNames": [
"option_id"
],
"columnNames": ["option_id"],
"localTableName": "public.product_option_value",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.product_option",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -1050,10 +991,7 @@
"indexes": [
{
"keyName": "product_tags_pkey",
"columnNames": [
"product_id",
"product_tag_id"
],
"columnNames": ["product_id", "product_tag_id"],
"composite": true,
"primary": true,
"unique": true
@@ -1063,26 +1001,18 @@
"foreignKeys": {
"product_tags_product_id_foreign": {
"constraintName": "product_tags_product_id_foreign",
"columnNames": [
"product_id"
],
"columnNames": ["product_id"],
"localTableName": "public.product_tags",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.product",
"deleteRule": "cascade",
"updateRule": "cascade"
},
"product_tags_product_tag_id_foreign": {
"constraintName": "product_tags_product_tag_id_foreign",
"columnNames": [
"product_tag_id"
],
"columnNames": ["product_tag_id"],
"localTableName": "public.product_tags",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.product_tag",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -1115,10 +1045,7 @@
"indexes": [
{
"keyName": "product_images_pkey",
"columnNames": [
"product_id",
"image_id"
],
"columnNames": ["product_id", "image_id"],
"composite": true,
"primary": true,
"unique": true
@@ -1128,26 +1055,18 @@
"foreignKeys": {
"product_images_product_id_foreign": {
"constraintName": "product_images_product_id_foreign",
"columnNames": [
"product_id"
],
"columnNames": ["product_id"],
"localTableName": "public.product_images",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.product",
"deleteRule": "cascade",
"updateRule": "cascade"
},
"product_images_image_id_foreign": {
"constraintName": "product_images_image_id_foreign",
"columnNames": [
"image_id"
],
"columnNames": ["image_id"],
"localTableName": "public.product_images",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.image",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -1180,10 +1099,7 @@
"indexes": [
{
"keyName": "product_category_product_pkey",
"columnNames": [
"product_id",
"product_category_id"
],
"columnNames": ["product_id", "product_category_id"],
"composite": true,
"primary": true,
"unique": true
@@ -1193,26 +1109,18 @@
"foreignKeys": {
"product_category_product_product_id_foreign": {
"constraintName": "product_category_product_product_id_foreign",
"columnNames": [
"product_id"
],
"columnNames": ["product_id"],
"localTableName": "public.product_category_product",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.product",
"deleteRule": "cascade",
"updateRule": "cascade"
},
"product_category_product_product_category_id_foreign": {
"constraintName": "product_category_product_product_category_id_foreign",
"columnNames": [
"product_category_id"
],
"columnNames": ["product_category_id"],
"localTableName": "public.product_category_product",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.product_category",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -1432,9 +1340,7 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"keyName": "IDX_product_variant_deleted_at",
"primary": false,
@@ -1442,9 +1348,7 @@
},
{
"keyName": "product_variant_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -1454,13 +1358,9 @@
"foreignKeys": {
"product_variant_product_id_foreign": {
"constraintName": "product_variant_product_id_foreign",
"columnNames": [
"product_id"
],
"columnNames": ["product_id"],
"localTableName": "public.product_variant",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.product",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -1493,10 +1393,7 @@
"indexes": [
{
"keyName": "product_variant_option_pkey",
"columnNames": [
"variant_id",
"option_value_id"
],
"columnNames": ["variant_id", "option_value_id"],
"composite": true,
"primary": true,
"unique": true
@@ -1506,26 +1403,18 @@
"foreignKeys": {
"product_variant_option_variant_id_foreign": {
"constraintName": "product_variant_option_variant_id_foreign",
"columnNames": [
"variant_id"
],
"columnNames": ["variant_id"],
"localTableName": "public.product_variant_option",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.product_variant",
"deleteRule": "cascade",
"updateRule": "cascade"
},
"product_variant_option_option_value_id_foreign": {
"constraintName": "product_variant_option_option_value_id_foreign",
"columnNames": [
"option_value_id"
],
"columnNames": ["option_value_id"],
"localTableName": "public.product_variant_option",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.product_option_value",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -4,12 +4,12 @@ export class Migration202408271511 extends Migration {
async up(): Promise<void> {
this.addSql(
'alter table if exists "product_category" add column if not exists "metadata" jsonb;'
);
)
}
async down(): Promise<void> {
this.addSql(
'alter table if exists "product_category" drop column if exists "metadata";'
);
)
}
}
@@ -1,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -100,9 +98,7 @@
"indexes": [
{
"keyName": "IDX_promotion_campaign_campaign_identifier_unique",
"columnNames": [
"campaign_identifier"
],
"columnNames": ["campaign_identifier"],
"composite": false,
"primary": false,
"unique": false,
@@ -110,9 +106,7 @@
},
{
"keyName": "promotion_campaign_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -139,10 +133,7 @@
"autoincrement": false,
"primary": false,
"nullable": false,
"enumItems": [
"spend",
"usage"
],
"enumItems": ["spend", "usage"],
"mappedType": "enum"
},
"campaign_id": {
@@ -237,18 +228,14 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"type"
],
"columnNames": ["type"],
"composite": false,
"keyName": "IDX_campaign_budget_type",
"primary": false,
"unique": false
},
{
"columnNames": [
"campaign_id"
],
"columnNames": ["campaign_id"],
"composite": false,
"keyName": "promotion_campaign_budget_campaign_id_unique",
"primary": false,
@@ -256,9 +243,7 @@
},
{
"keyName": "promotion_campaign_budget_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -268,13 +253,9 @@
"foreignKeys": {
"promotion_campaign_budget_campaign_id_foreign": {
"constraintName": "promotion_campaign_budget_campaign_id_foreign",
"columnNames": [
"campaign_id"
],
"columnNames": ["campaign_id"],
"localTableName": "public.promotion_campaign_budget",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.promotion_campaign",
"updateRule": "cascade"
}
@@ -326,10 +307,7 @@
"autoincrement": false,
"primary": false,
"nullable": false,
"enumItems": [
"standard",
"buyget"
],
"enumItems": ["standard", "buyget"],
"mappedType": "enum"
},
"created_at": {
@@ -369,18 +347,14 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"code"
],
"columnNames": ["code"],
"composite": false,
"keyName": "IDX_promotion_code",
"primary": false,
"unique": false
},
{
"columnNames": [
"type"
],
"columnNames": ["type"],
"composite": false,
"keyName": "IDX_promotion_type",
"primary": false,
@@ -388,18 +362,14 @@
},
{
"keyName": "IDX_promotion_code_unique",
"columnNames": [
"code"
],
"columnNames": ["code"],
"composite": false,
"primary": false,
"unique": true
},
{
"keyName": "promotion_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -409,13 +379,9 @@
"foreignKeys": {
"promotion_campaign_id_foreign": {
"constraintName": "promotion_campaign_id_foreign",
"columnNames": [
"campaign_id"
],
"columnNames": ["campaign_id"],
"localTableName": "public.promotion",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.promotion_campaign",
"deleteRule": "set null",
"updateRule": "cascade"
@@ -494,10 +460,7 @@
"autoincrement": false,
"primary": false,
"nullable": false,
"enumItems": [
"fixed",
"percentage"
],
"enumItems": ["fixed", "percentage"],
"mappedType": "enum"
},
"target_type": {
@@ -507,11 +470,7 @@
"autoincrement": false,
"primary": false,
"nullable": false,
"enumItems": [
"order",
"shipping_methods",
"items"
],
"enumItems": ["order", "shipping_methods", "items"],
"mappedType": "enum"
},
"allocation": {
@@ -521,10 +480,7 @@
"autoincrement": false,
"primary": false,
"nullable": true,
"enumItems": [
"each",
"across"
],
"enumItems": ["each", "across"],
"mappedType": "enum"
},
"promotion_id": {
@@ -573,36 +529,28 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"type"
],
"columnNames": ["type"],
"composite": false,
"keyName": "IDX_application_method_type",
"primary": false,
"unique": false
},
{
"columnNames": [
"target_type"
],
"columnNames": ["target_type"],
"composite": false,
"keyName": "IDX_application_method_target_type",
"primary": false,
"unique": false
},
{
"columnNames": [
"allocation"
],
"columnNames": ["allocation"],
"composite": false,
"keyName": "IDX_application_method_allocation",
"primary": false,
"unique": false
},
{
"columnNames": [
"promotion_id"
],
"columnNames": ["promotion_id"],
"composite": false,
"keyName": "promotion_application_method_promotion_id_unique",
"primary": false,
@@ -610,9 +558,7 @@
},
{
"keyName": "IDX_promotion_application_method_currency_code",
"columnNames": [
"currency_code"
],
"columnNames": ["currency_code"],
"composite": false,
"primary": false,
"unique": false,
@@ -620,9 +566,7 @@
},
{
"keyName": "promotion_application_method_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -632,13 +576,9 @@
"foreignKeys": {
"promotion_application_method_promotion_id_foreign": {
"constraintName": "promotion_application_method_promotion_id_foreign",
"columnNames": [
"promotion_id"
],
"columnNames": ["promotion_id"],
"localTableName": "public.promotion_application_method",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.promotion",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -681,15 +621,7 @@
"autoincrement": false,
"primary": false,
"nullable": false,
"enumItems": [
"gte",
"lte",
"gt",
"lt",
"eq",
"ne",
"in"
],
"enumItems": ["gte", "lte", "gt", "lt", "eq", "ne", "in"],
"mappedType": "enum"
},
"created_at": {
@@ -729,18 +661,14 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"attribute"
],
"columnNames": ["attribute"],
"composite": false,
"keyName": "IDX_promotion_rule_attribute",
"primary": false,
"unique": false
},
{
"columnNames": [
"operator"
],
"columnNames": ["operator"],
"composite": false,
"keyName": "IDX_promotion_rule_operator",
"primary": false,
@@ -748,9 +676,7 @@
},
{
"keyName": "promotion_rule_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -785,10 +711,7 @@
"indexes": [
{
"keyName": "promotion_promotion_rule_pkey",
"columnNames": [
"promotion_id",
"promotion_rule_id"
],
"columnNames": ["promotion_id", "promotion_rule_id"],
"composite": true,
"primary": true,
"unique": true
@@ -798,26 +721,18 @@
"foreignKeys": {
"promotion_promotion_rule_promotion_id_foreign": {
"constraintName": "promotion_promotion_rule_promotion_id_foreign",
"columnNames": [
"promotion_id"
],
"columnNames": ["promotion_id"],
"localTableName": "public.promotion_promotion_rule",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.promotion",
"deleteRule": "cascade",
"updateRule": "cascade"
},
"promotion_promotion_rule_promotion_rule_id_foreign": {
"constraintName": "promotion_promotion_rule_promotion_rule_id_foreign",
"columnNames": [
"promotion_rule_id"
],
"columnNames": ["promotion_rule_id"],
"localTableName": "public.promotion_promotion_rule",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.promotion_rule",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -850,10 +765,7 @@
"indexes": [
{
"keyName": "application_method_target_rules_pkey",
"columnNames": [
"application_method_id",
"promotion_rule_id"
],
"columnNames": ["application_method_id", "promotion_rule_id"],
"composite": true,
"primary": true,
"unique": true
@@ -863,26 +775,18 @@
"foreignKeys": {
"application_method_target_rules_application_method_id_foreign": {
"constraintName": "application_method_target_rules_application_method_id_foreign",
"columnNames": [
"application_method_id"
],
"columnNames": ["application_method_id"],
"localTableName": "public.application_method_target_rules",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.promotion_application_method",
"deleteRule": "cascade",
"updateRule": "cascade"
},
"application_method_target_rules_promotion_rule_id_foreign": {
"constraintName": "application_method_target_rules_promotion_rule_id_foreign",
"columnNames": [
"promotion_rule_id"
],
"columnNames": ["promotion_rule_id"],
"localTableName": "public.application_method_target_rules",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.promotion_rule",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -915,10 +819,7 @@
"indexes": [
{
"keyName": "application_method_buy_rules_pkey",
"columnNames": [
"application_method_id",
"promotion_rule_id"
],
"columnNames": ["application_method_id", "promotion_rule_id"],
"composite": true,
"primary": true,
"unique": true
@@ -928,26 +829,18 @@
"foreignKeys": {
"application_method_buy_rules_application_method_id_foreign": {
"constraintName": "application_method_buy_rules_application_method_id_foreign",
"columnNames": [
"application_method_id"
],
"columnNames": ["application_method_id"],
"localTableName": "public.application_method_buy_rules",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.promotion_application_method",
"deleteRule": "cascade",
"updateRule": "cascade"
},
"application_method_buy_rules_promotion_rule_id_foreign": {
"constraintName": "application_method_buy_rules_promotion_rule_id_foreign",
"columnNames": [
"promotion_rule_id"
],
"columnNames": ["promotion_rule_id"],
"localTableName": "public.application_method_buy_rules",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.promotion_rule",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -1020,9 +913,7 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"promotion_rule_id"
],
"columnNames": ["promotion_rule_id"],
"composite": false,
"keyName": "IDX_promotion_rule_promotion_rule_value_id",
"primary": false,
@@ -1030,9 +921,7 @@
},
{
"keyName": "promotion_rule_value_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -1042,13 +931,9 @@
"foreignKeys": {
"promotion_rule_value_promotion_rule_id_foreign": {
"constraintName": "promotion_rule_value_promotion_rule_id_foreign",
"columnNames": [
"promotion_rule_id"
],
"columnNames": ["promotion_rule_id"],
"localTableName": "public.promotion_rule_value",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.promotion_rule",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -4,4 +4,3 @@ export { default as StripeGiropayService } from "./stripe-giropay"
export { default as StripeIdealService } from "./stripe-ideal"
export { default as StripeProviderService } from "./stripe-provider"
export { default as StripePrzelewy24Service } from "./stripe-przelewy24"
@@ -1,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -90,9 +88,7 @@
"indexes": [
{
"keyName": "region_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -212,9 +208,7 @@
},
{
"keyName": "region_country_pkey",
"columnNames": [
"iso_2"
],
"columnNames": ["iso_2"],
"composite": false,
"primary": true,
"unique": true
@@ -224,13 +218,9 @@
"foreignKeys": {
"region_country_region_id_foreign": {
"constraintName": "region_country_region_id_foreign",
"columnNames": [
"region_id"
],
"columnNames": ["region_id"],
"localTableName": "public.region_country",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.region",
"deleteRule": "set null",
"updateRule": "cascade"
@@ -1,2 +1 @@
export { default as RegionModuleService } from "./region-module";
export { default as RegionModuleService } from "./region-module"
@@ -1,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -89,9 +87,7 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"keyName": "IDX_sales_channel_deleted_at",
"primary": false,
@@ -99,9 +95,7 @@
},
{
"keyName": "sales_channel_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -1,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -134,9 +132,7 @@
"indexes": [
{
"keyName": "IDX_stock_location_address_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -144,9 +140,7 @@
},
{
"keyName": "stock_location_address_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -231,9 +225,7 @@
"indexes": [
{
"keyName": "IDX_stock_location_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -241,9 +233,7 @@
},
{
"keyName": "stock_location_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -253,13 +243,9 @@
"foreignKeys": {
"stock_location_address_id_foreign": {
"constraintName": "stock_location_address_id_foreign",
"columnNames": [
"address_id"
],
"columnNames": ["address_id"],
"localTableName": "public.stock_location",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.stock_location_address",
"deleteRule": "set null",
"updateRule": "cascade"
@@ -1,23 +1,33 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@mikro-orm/migrations"
export class Migration20240307161216 extends Migration {
async up(): Promise<void> {
this.addSql('create table if not exists "stock_location_address" ("id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, "address_1" text not null, "address_2" text null, "company" text null, "city" text null, "country_code" text not null, "phone" text null, "province" text null, "postal_code" text null, "metadata" jsonb null, constraint "stock_location_address_pkey" primary key ("id"));');
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_stock_location_address_deleted_at" ON "stock_location_address" (deleted_at) WHERE deleted_at IS NOT NULL;');
this.addSql(
'create table if not exists "stock_location_address" ("id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, "address_1" text not null, "address_2" text null, "company" text null, "city" text null, "country_code" text not null, "phone" text null, "province" text null, "postal_code" text null, "metadata" jsonb null, constraint "stock_location_address_pkey" primary key ("id"));'
)
this.addSql(
'CREATE INDEX IF NOT EXISTS "IDX_stock_location_address_deleted_at" ON "stock_location_address" (deleted_at) WHERE deleted_at IS NOT NULL;'
)
this.addSql('create table if not exists "stock_location" ("id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, "name" text not null, "address_id" text null, "metadata" jsonb null, constraint "stock_location_pkey" primary key ("id"));');
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_stock_location_deleted_at" ON "stock_location" (deleted_at) WHERE deleted_at IS NOT NULL;');
this.addSql(
'create table if not exists "stock_location" ("id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, "name" text not null, "address_id" text null, "metadata" jsonb null, constraint "stock_location_pkey" primary key ("id"));'
)
this.addSql(
'CREATE INDEX IF NOT EXISTS "IDX_stock_location_deleted_at" ON "stock_location" (deleted_at) WHERE deleted_at IS NOT NULL;'
)
this.addSql('alter table if exists "stock_location" add constraint "stock_location_address_id_foreign" foreign key ("address_id") references "stock_location_address" ("id") on update cascade on delete set null;');
this.addSql(
'alter table if exists "stock_location" add constraint "stock_location_address_id_foreign" foreign key ("address_id") references "stock_location_address" ("id") on update cascade on delete set null;'
)
}
async down(): Promise<void> {
this.addSql('alter table if exists "stock_location" drop constraint if exists "stock_location_address_id_foreign";');
this.addSql(
'alter table if exists "stock_location" drop constraint if exists "stock_location_address_id_foreign";'
)
this.addSql('drop table if exists "stock_location_address" cascade;');
this.addSql('drop table if exists "stock_location_address" cascade;')
this.addSql('drop table if exists "stock_location" cascade;');
this.addSql('drop table if exists "stock_location" cascade;')
}
}
@@ -1,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -99,9 +97,7 @@
"indexes": [
{
"keyName": "IDX_store_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -109,9 +105,7 @@
},
{
"keyName": "store_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -197,9 +191,7 @@
"indexes": [
{
"keyName": "IDX_store_currency_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -207,9 +199,7 @@
},
{
"keyName": "store_currency_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -219,13 +209,9 @@
"foreignKeys": {
"store_currency_store_id_foreign": {
"constraintName": "store_currency_store_id_foreign",
"columnNames": [
"store_id"
],
"columnNames": ["store_id"],
"localTableName": "public.store_currency",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.store",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -5,7 +5,7 @@ import {
ModuleProvider,
ModulesSdkTypes,
} from "@medusajs/framework/types"
import { Lifetime, asFunction } from "awilix"
import { asFunction, Lifetime } from "awilix"
import * as providers from "../providers"
@@ -1,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -31,9 +29,7 @@
"indexes": [
{
"keyName": "tax_provider_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -144,9 +140,7 @@
"schema": "public",
"indexes": [
{
"columnNames": [
"parent_id"
],
"columnNames": ["parent_id"],
"composite": false,
"keyName": "IDX_tax_region_parent_id",
"primary": false,
@@ -154,9 +148,7 @@
},
{
"keyName": "IDX_tax_region_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -180,9 +172,7 @@
},
{
"keyName": "tax_region_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -203,26 +193,18 @@
"foreignKeys": {
"tax_region_provider_id_foreign": {
"constraintName": "tax_region_provider_id_foreign",
"columnNames": [
"provider_id"
],
"columnNames": ["provider_id"],
"localTableName": "public.tax_region",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.tax_provider",
"deleteRule": "set null",
"updateRule": "cascade"
},
"tax_region_parent_id_foreign": {
"constraintName": "tax_region_parent_id_foreign",
"columnNames": [
"parent_id"
],
"columnNames": ["parent_id"],
"localTableName": "public.tax_region",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.tax_region",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -352,9 +334,7 @@
"indexes": [
{
"keyName": "IDX_tax_rate_tax_region_id",
"columnNames": [
"tax_region_id"
],
"columnNames": ["tax_region_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -362,9 +342,7 @@
},
{
"keyName": "IDX_tax_rate_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -380,9 +358,7 @@
},
{
"keyName": "tax_rate_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -392,13 +368,9 @@
"foreignKeys": {
"tax_rate_tax_region_id_foreign": {
"constraintName": "tax_rate_tax_region_id_foreign",
"columnNames": [
"tax_region_id"
],
"columnNames": ["tax_region_id"],
"localTableName": "public.tax_rate",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.tax_region",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -499,9 +471,7 @@
"indexes": [
{
"keyName": "IDX_tax_rate_rule_tax_rate_id",
"columnNames": [
"tax_rate_id"
],
"columnNames": ["tax_rate_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -509,9 +479,7 @@
},
{
"keyName": "IDX_tax_rate_rule_reference_id",
"columnNames": [
"reference_id"
],
"columnNames": ["reference_id"],
"composite": false,
"primary": false,
"unique": false,
@@ -519,9 +487,7 @@
},
{
"keyName": "IDX_tax_rate_rule_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -537,9 +503,7 @@
},
{
"keyName": "tax_rate_rule_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -549,13 +513,9 @@
"foreignKeys": {
"tax_rate_rule_tax_rate_id_foreign": {
"constraintName": "tax_rate_rule_tax_rate_id_foreign",
"columnNames": [
"tax_rate_id"
],
"columnNames": ["tax_rate_id"],
"localTableName": "public.tax_rate_rule",
"referencedColumnNames": [
"id"
],
"referencedColumnNames": ["id"],
"referencedTableName": "public.tax_rate",
"deleteRule": "cascade",
"updateRule": "cascade"
@@ -1,17 +1,27 @@
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@mikro-orm/migrations"
export class Migration20240710135844 extends Migration {
async up(): Promise<void> {
this.addSql('drop index if exists "IDX_tax_region_unique_country_province";');
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_tax_region_unique_country_province" ON "tax_region" (country_code, province_code) WHERE deleted_at IS NULL;');
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_tax_region_unique_country_nullable_province" ON "tax_region" (country_code) WHERE province_code IS NULL AND deleted_at IS NULL;');
this.addSql(
'drop index if exists "IDX_tax_region_unique_country_province";'
)
this.addSql(
'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_tax_region_unique_country_province" ON "tax_region" (country_code, province_code) WHERE deleted_at IS NULL;'
)
this.addSql(
'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_tax_region_unique_country_nullable_province" ON "tax_region" (country_code) WHERE province_code IS NULL AND deleted_at IS NULL;'
)
}
async down(): Promise<void> {
this.addSql('drop index if exists "IDX_tax_region_unique_country_province";');
this.addSql('drop index if exists "IDX_tax_region_unique_country_nullable_province";');
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_tax_region_unique_country_province" ON "tax_region" (country_code, province_code);');
this.addSql(
'drop index if exists "IDX_tax_region_unique_country_province";'
)
this.addSql(
'drop index if exists "IDX_tax_region_unique_country_nullable_province";'
)
this.addSql(
'CREATE UNIQUE INDEX IF NOT EXISTS "IDX_tax_region_unique_country_province" ON "tax_region" (country_code, province_code);'
)
}
}
@@ -2,9 +2,7 @@ import { Migration } from "@mikro-orm/migrations"
export class Migration20240924114005 extends Migration {
async up(): Promise<void> {
this.addSql(
`UPDATE "tax_rate" SET code = 'default' WHERE code IS NULL;`
)
this.addSql(`UPDATE "tax_rate" SET code = 'default' WHERE code IS NULL;`)
this.addSql(
`ALTER TABLE IF EXISTS "tax_rate" ALTER COLUMN "code" SET NOT NULL;`
)
@@ -1,7 +1,7 @@
import { DAL } from "@medusajs/framework/types"
import {
DALUtils,
createPsqlIndexStatementHelper,
DALUtils,
generateEntityId,
} from "@medusajs/framework/utils"
import {
@@ -1,9 +1,9 @@
import { DAL } from "@medusajs/framework/types"
import {
DALUtils,
Searchable,
createPsqlIndexStatementHelper,
DALUtils,
generateEntityId,
Searchable,
} from "@medusajs/framework/utils"
import {
BeforeCreate,
@@ -13,8 +13,8 @@ import {
Entity,
Filter,
ManyToOne,
OnInit,
OneToMany,
OnInit,
OptionalProps,
PrimaryKey,
Property,
@@ -1,7 +1,5 @@
{
"namespaces": [
"public"
],
"namespaces": ["public"],
"name": "public",
"tables": [
{
@@ -100,9 +98,7 @@
"indexes": [
{
"keyName": "IDX_invite_email",
"columnNames": [
"email"
],
"columnNames": ["email"],
"composite": false,
"primary": false,
"unique": false,
@@ -110,9 +106,7 @@
},
{
"keyName": "IDX_invite_token",
"columnNames": [
"token"
],
"columnNames": ["token"],
"composite": false,
"primary": false,
"unique": false,
@@ -120,9 +114,7 @@
},
{
"keyName": "IDX_invite_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -130,9 +122,7 @@
},
{
"keyName": "invite_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true
@@ -235,9 +225,7 @@
"indexes": [
{
"keyName": "IDX_user_email",
"columnNames": [
"email"
],
"columnNames": ["email"],
"composite": false,
"primary": false,
"unique": false,
@@ -245,9 +233,7 @@
},
{
"keyName": "IDX_user_deleted_at",
"columnNames": [
"deleted_at"
],
"columnNames": ["deleted_at"],
"composite": false,
"primary": false,
"unique": false,
@@ -255,9 +241,7 @@
},
{
"keyName": "user_pkey",
"columnNames": [
"id"
],
"columnNames": ["id"],
"composite": false,
"primary": true,
"unique": true