chore: V2 core loader + modules integration-tests (#6544)
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
"ignore": [
|
"ignore": [
|
||||||
"integration-tests-api",
|
"integration-tests-api",
|
||||||
"integration-tests-plugins",
|
"integration-tests-plugins",
|
||||||
|
"integration-tests-modules",
|
||||||
"integration-tests-repositories",
|
"integration-tests-repositories",
|
||||||
"@medusajs/dashboard",
|
"@medusajs/dashboard",
|
||||||
"@medusajs/admin-shared",
|
"@medusajs/admin-shared",
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/medusa": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
chore: V2 core loader + modules integration-tests
|
||||||
@@ -241,6 +241,59 @@ jobs:
|
|||||||
DB_PASSWORD: postgres
|
DB_PASSWORD: postgres
|
||||||
NODE_OPTIONS: "--max_old_space_size=4096"
|
NODE_OPTIONS: "--max_old_space_size=4096"
|
||||||
|
|
||||||
|
integration-tests-modules:
|
||||||
|
needs: setup
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||||
|
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
||||||
|
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres
|
||||||
|
env:
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
options: >-
|
||||||
|
--health-cmd pg_isready
|
||||||
|
--health-interval 1s
|
||||||
|
--health-timeout 10s
|
||||||
|
--health-retries 10
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Cancel Previous Runs
|
||||||
|
uses: styfle/cancel-workflow-action@0.11.0
|
||||||
|
with:
|
||||||
|
access_token: ${{ github.token }}
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup Node.js environment
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: "16.10.0"
|
||||||
|
cache: "yarn"
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
uses: ./.github/actions/cache-deps
|
||||||
|
with:
|
||||||
|
extension: pipeline
|
||||||
|
|
||||||
|
- name: Build Packages
|
||||||
|
run: yarn build
|
||||||
|
|
||||||
|
- name: Run Modules integration tests
|
||||||
|
run: yarn test:integration:modules
|
||||||
|
env:
|
||||||
|
DB_USERNAME: postgres
|
||||||
|
DB_PASSWORD: postgres
|
||||||
|
NODE_OPTIONS: "--max_old_space_size=4096"
|
||||||
|
|
||||||
integration-tests-repositories:
|
integration-tests-repositories:
|
||||||
needs: setup
|
needs: setup
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Cart } from "@medusajs/medusa"
|
import { Cart } from "@medusajs/medusa"
|
||||||
|
import { generateEntityId } from "@medusajs/utils"
|
||||||
import faker from "faker"
|
import faker from "faker"
|
||||||
import { DataSource } from "typeorm"
|
import { DataSource } from "typeorm"
|
||||||
import {
|
import {
|
||||||
@@ -19,7 +20,6 @@ import {
|
|||||||
ShippingMethodFactoryData,
|
ShippingMethodFactoryData,
|
||||||
simpleShippingMethodFactory,
|
simpleShippingMethodFactory,
|
||||||
} from "./simple-shipping-method-factory"
|
} from "./simple-shipping-method-factory"
|
||||||
import { generateEntityId } from "@medusajs/utils"
|
|
||||||
|
|
||||||
export type CartFactoryData = {
|
export type CartFactoryData = {
|
||||||
id?: string
|
id?: string
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
let ignore = [`**/dist`]
|
||||||
|
|
||||||
|
// Jest needs to compile this code, but generally we don't want this copied
|
||||||
|
// to output folders
|
||||||
|
if (process.env.NODE_ENV !== `test`) {
|
||||||
|
ignore.push(`**/__tests__`)
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
sourceMaps: true,
|
||||||
|
presets: ["babel-preset-medusa-package"],
|
||||||
|
ignore,
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
dist/
|
||||||
|
node_modules
|
||||||
|
*yarn-error.log
|
||||||
|
|
||||||
+4
-5
@@ -1,12 +1,11 @@
|
|||||||
import { initDb, useDb } from "../../../../environment-helpers/use-db"
|
|
||||||
|
|
||||||
import { IRegionModuleService } from "@medusajs/types"
|
|
||||||
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
|
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
|
||||||
import { createAdminUser } from "../../../helpers/create-admin-user"
|
import { IRegionModuleService } from "@medusajs/types"
|
||||||
import { getContainer } from "../../../../environment-helpers/use-container"
|
|
||||||
import path from "path"
|
import path from "path"
|
||||||
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"
|
import { startBootstrapApp } from "../../../../environment-helpers/bootstrap-app"
|
||||||
import { useApi } from "../../../../environment-helpers/use-api"
|
import { useApi } from "../../../../environment-helpers/use-api"
|
||||||
|
import { getContainer } from "../../../../environment-helpers/use-container"
|
||||||
|
import { initDb, useDb } from "../../../../environment-helpers/use-db"
|
||||||
|
import { createAdminUser } from "../../../helpers/create-admin-user"
|
||||||
|
|
||||||
jest.setTimeout(50000)
|
jest.setTimeout(50000)
|
||||||
|
|
||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
import { IAuthModuleService } from "@medusajs/types"
|
|
||||||
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
|
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
|
||||||
import adminSeeder from "../../helpers/admin-seeder"
|
import { IAuthModuleService } from "@medusajs/types"
|
||||||
import { getContainer } from "../../environment-helpers/use-container"
|
|
||||||
import jwt from "jsonwebtoken"
|
import jwt from "jsonwebtoken"
|
||||||
|
import { getContainer } from "../../environment-helpers/use-container"
|
||||||
|
import adminSeeder from "../../helpers/admin-seeder"
|
||||||
|
|
||||||
export const createAdminUser = async (dbConnection, adminHeaders) => {
|
export const createAdminUser = async (dbConnection, adminHeaders) => {
|
||||||
await adminSeeder(dbConnection)
|
await adminSeeder(dbConnection)
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
process.chdir(__dirname)
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: "Modules",
|
||||||
|
testEnvironment: `node`,
|
||||||
|
rootDir: "./",
|
||||||
|
testPathIgnorePatterns: [
|
||||||
|
`/examples/`,
|
||||||
|
`/www/`,
|
||||||
|
`/dist/`,
|
||||||
|
`/node_modules/`,
|
||||||
|
`<rootDir>/node_modules/`,
|
||||||
|
`__tests__/fixtures`,
|
||||||
|
`__testfixtures__`,
|
||||||
|
`.cache`,
|
||||||
|
],
|
||||||
|
transformIgnorePatterns: [`/dist`],
|
||||||
|
transform: { "^.+\\.[jt]s$": `../../jest-transformer.js` },
|
||||||
|
setupFiles: ["../setup-env.js"],
|
||||||
|
setupFilesAfterEnv: ["../setup.js"],
|
||||||
|
globalSetup: "../globalSetup.js",
|
||||||
|
globalTeardown: "../globalTeardown.js",
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
const { Modules } = require("@medusajs/modules-sdk")
|
||||||
|
const DB_HOST = process.env.DB_HOST
|
||||||
|
const DB_USERNAME = process.env.DB_USERNAME
|
||||||
|
const DB_PASSWORD = process.env.DB_PASSWORD
|
||||||
|
const DB_NAME = process.env.DB_TEMP_NAME
|
||||||
|
const DB_URL = `postgres://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}`
|
||||||
|
process.env.POSTGRES_URL = DB_URL
|
||||||
|
|
||||||
|
const enableMedusaV2 = process.env.MEDUSA_FF_MEDUSA_V2 == "true"
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
plugins: [],
|
||||||
|
projectConfig: {
|
||||||
|
database_url: DB_URL,
|
||||||
|
database_type: "postgres",
|
||||||
|
jwt_secret: "test",
|
||||||
|
cookie_secret: "test",
|
||||||
|
},
|
||||||
|
featureFlags: {
|
||||||
|
medusa_v2: enableMedusaV2,
|
||||||
|
},
|
||||||
|
modules: {
|
||||||
|
[Modules.AUTH]: {
|
||||||
|
scope: "internal",
|
||||||
|
resources: "shared",
|
||||||
|
resolve: "@medusajs/auth",
|
||||||
|
options: {
|
||||||
|
providers: [
|
||||||
|
{
|
||||||
|
name: "emailpass",
|
||||||
|
scopes: {
|
||||||
|
admin: {},
|
||||||
|
store: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
[Modules.USER]: {
|
||||||
|
scope: "internal",
|
||||||
|
resources: "shared",
|
||||||
|
resolve: "@medusajs/user",
|
||||||
|
options: {
|
||||||
|
jwt_secret: "test",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
[Modules.CACHE]: {
|
||||||
|
resolve: "@medusajs/cache-inmemory",
|
||||||
|
options: { ttl: 0 }, // Cache disabled
|
||||||
|
},
|
||||||
|
[Modules.STOCK_LOCATION]: true,
|
||||||
|
[Modules.INVENTORY]: true,
|
||||||
|
[Modules.PRODUCT]: true,
|
||||||
|
[Modules.PRICING]: true,
|
||||||
|
[Modules.PROMOTION]: true,
|
||||||
|
[Modules.CUSTOMER]: true,
|
||||||
|
[Modules.SALES_CHANNEL]: true,
|
||||||
|
[Modules.CART]: true,
|
||||||
|
[Modules.WORKFLOW_ENGINE]: true,
|
||||||
|
[Modules.REGION]: true,
|
||||||
|
[Modules.API_KEY]: true,
|
||||||
|
[Modules.STORE]: true,
|
||||||
|
[Modules.TAX]: true,
|
||||||
|
[Modules.CURRENCY]: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
"name": "integration-tests-modules",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "index.js",
|
||||||
|
"license": "MIT",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"test:integration": "node --expose-gc ./../../node_modules/.bin/jest --silent=false --runInBand --bail --detectOpenHandles --logHeapUsage --clearMocks --forceExit",
|
||||||
|
"build": "babel src -d dist --extensions \".ts,.js\""
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@medusajs/api-key": "workspace:^",
|
||||||
|
"@medusajs/auth": "workspace:*",
|
||||||
|
"@medusajs/cache-inmemory": "workspace:*",
|
||||||
|
"@medusajs/customer": "workspace:^",
|
||||||
|
"@medusajs/event-bus-local": "workspace:*",
|
||||||
|
"@medusajs/inventory": "workspace:^",
|
||||||
|
"@medusajs/medusa": "workspace:*",
|
||||||
|
"@medusajs/modules-sdk": "workspace:^",
|
||||||
|
"@medusajs/pricing": "workspace:^",
|
||||||
|
"@medusajs/product": "workspace:^",
|
||||||
|
"@medusajs/promotion": "workspace:^",
|
||||||
|
"@medusajs/region": "workspace:^",
|
||||||
|
"@medusajs/store": "workspace:^",
|
||||||
|
"@medusajs/tax": "workspace:^",
|
||||||
|
"@medusajs/user": "workspace:^",
|
||||||
|
"@medusajs/utils": "workspace:^",
|
||||||
|
"@medusajs/workflow-engine-inmemory": "workspace:*",
|
||||||
|
"faker": "^5.5.3",
|
||||||
|
"medusa-fulfillment-webshipper": "workspace:*",
|
||||||
|
"medusa-interfaces": "workspace:*",
|
||||||
|
"medusa-plugin-sendgrid": "workspace:*",
|
||||||
|
"pg": "^8.11.0",
|
||||||
|
"typeorm": "^0.3.16"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/cli": "^7.12.10",
|
||||||
|
"@babel/core": "^7.12.10",
|
||||||
|
"@babel/node": "^7.12.10",
|
||||||
|
"@medusajs/types": "workspace:^",
|
||||||
|
"babel-preset-medusa-package": "*",
|
||||||
|
"jest": "^26.6.3",
|
||||||
|
"jest-environment-node": "26.6.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
// noop
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
const { Modules } = require("@medusajs/modules-sdk")
|
const { Modules } = require("@medusajs/modules-sdk")
|
||||||
const { Workflows } = require("@medusajs/core-flows")
|
|
||||||
const DB_HOST = process.env.DB_HOST
|
const DB_HOST = process.env.DB_HOST
|
||||||
const DB_USERNAME = process.env.DB_USERNAME
|
const DB_USERNAME = process.env.DB_USERNAME
|
||||||
const DB_PASSWORD = process.env.DB_PASSWORD
|
const DB_PASSWORD = process.env.DB_PASSWORD
|
||||||
@@ -55,14 +54,6 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[Modules.USER]: {
|
|
||||||
scope: "internal",
|
|
||||||
resources: "shared",
|
|
||||||
resolve: "@medusajs/user",
|
|
||||||
options: {
|
|
||||||
jwt_secret: "test",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
[Modules.STOCK_LOCATION]: {
|
[Modules.STOCK_LOCATION]: {
|
||||||
scope: "internal",
|
scope: "internal",
|
||||||
resources: "shared",
|
resources: "shared",
|
||||||
@@ -82,56 +73,6 @@ module.exports = {
|
|||||||
resources: "shared",
|
resources: "shared",
|
||||||
resolve: "@medusajs/product",
|
resolve: "@medusajs/product",
|
||||||
},
|
},
|
||||||
[Modules.PRICING]: {
|
|
||||||
scope: "internal",
|
|
||||||
resources: "shared",
|
|
||||||
resolve: "@medusajs/pricing",
|
|
||||||
},
|
|
||||||
[Modules.PROMOTION]: {
|
|
||||||
scope: "internal",
|
|
||||||
resources: "shared",
|
|
||||||
resolve: "@medusajs/promotion",
|
|
||||||
},
|
|
||||||
[Modules.CUSTOMER]: {
|
|
||||||
scope: "internal",
|
|
||||||
resources: "shared",
|
|
||||||
resolve: "@medusajs/customer",
|
|
||||||
},
|
|
||||||
[Modules.SALES_CHANNEL]: {
|
|
||||||
scope: "internal",
|
|
||||||
resources: "shared",
|
|
||||||
resolve: "@medusajs/sales-channel",
|
|
||||||
},
|
|
||||||
[Modules.CART]: {
|
|
||||||
scope: "internal",
|
|
||||||
resources: "shared",
|
|
||||||
resolve: "@medusajs/cart",
|
|
||||||
},
|
|
||||||
[Modules.WORKFLOW_ENGINE]: true,
|
[Modules.WORKFLOW_ENGINE]: true,
|
||||||
[Modules.REGION]: {
|
|
||||||
scope: "internal",
|
|
||||||
resources: "shared",
|
|
||||||
resolve: "@medusajs/region",
|
|
||||||
},
|
|
||||||
[Modules.API_KEY]: {
|
|
||||||
scope: "internal",
|
|
||||||
resources: "shared",
|
|
||||||
resolve: "@medusajs/api-key",
|
|
||||||
},
|
|
||||||
[Modules.STORE]: {
|
|
||||||
scope: "internal",
|
|
||||||
resources: "shared",
|
|
||||||
resolve: "@medusajs/store",
|
|
||||||
},
|
|
||||||
[Modules.TAX]: {
|
|
||||||
scope: "internal",
|
|
||||||
resources: "shared",
|
|
||||||
resolve: "@medusajs/tax",
|
|
||||||
},
|
|
||||||
[Modules.CURRENCY]: {
|
|
||||||
scope: "internal",
|
|
||||||
resources: "shared",
|
|
||||||
resolve: "@medusajs/currency",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,6 +74,7 @@
|
|||||||
"test:integration:packages": "turbo run test:integration --concurrency=1 --no-daemon --filter='./packages/*'",
|
"test:integration:packages": "turbo run test:integration --concurrency=1 --no-daemon --filter='./packages/*'",
|
||||||
"test:integration:api": "turbo run test:integration --concurrency=50% --no-daemon --filter=integration-tests-api",
|
"test:integration:api": "turbo run test:integration --concurrency=50% --no-daemon --filter=integration-tests-api",
|
||||||
"test:integration:plugins": "turbo run test:integration --concurrency=50% --no-daemon --filter=integration-tests-plugins",
|
"test:integration:plugins": "turbo run test:integration --concurrency=50% --no-daemon --filter=integration-tests-plugins",
|
||||||
|
"test:integration:modules": "turbo run test:integration --concurrency=50% --no-daemon --filter=integration-tests-modules",
|
||||||
"test:integration:repositories": "turbo run test:integration --concurrency=50% --no-daemon --filter=integration-tests-repositories",
|
"test:integration:repositories": "turbo run test:integration --concurrency=50% --no-daemon --filter=integration-tests-repositories",
|
||||||
"openapi:generate": "yarn ./packages/oas/oas-github-ci run ci --with-full-file",
|
"openapi:generate": "yarn ./packages/oas/oas-github-ci run ci --with-full-file",
|
||||||
"medusa-oas": "yarn ./packages/oas/medusa-oas-cli run medusa-oas",
|
"medusa-oas": "yarn ./packages/oas/medusa-oas-cli run medusa-oas",
|
||||||
|
|||||||
@@ -8,10 +8,7 @@ import { Express, NextFunction, Request, Response } from "express"
|
|||||||
import databaseLoader, { dataSource } from "./database"
|
import databaseLoader, { dataSource } from "./database"
|
||||||
import pluginsLoader, { registerPluginModels } from "./plugins"
|
import pluginsLoader, { registerPluginModels } from "./plugins"
|
||||||
|
|
||||||
import {
|
import { ContainerRegistrationKeys, isString } from "@medusajs/utils"
|
||||||
ContainerRegistrationKeys,
|
|
||||||
isString
|
|
||||||
} from "@medusajs/utils"
|
|
||||||
import { asValue } from "awilix"
|
import { asValue } from "awilix"
|
||||||
import { createMedusaContainer } from "medusa-core-utils"
|
import { createMedusaContainer } from "medusa-core-utils"
|
||||||
import { track } from "medusa-telemetry"
|
import { track } from "medusa-telemetry"
|
||||||
@@ -82,16 +79,75 @@ async function loadLegacyModulesEntities(configModules, container) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function loadMedusaV2({ directory, expressApp }) {
|
||||||
|
const configModule = loadConfig(directory)
|
||||||
|
|
||||||
|
const container = createMedusaContainer()
|
||||||
|
|
||||||
|
// Add additional information to context of request
|
||||||
|
expressApp.use((req: Request, res: Response, next: NextFunction) => {
|
||||||
|
const ipAddress = requestIp.getClientIp(req) as string
|
||||||
|
;(req as any).request_context = {
|
||||||
|
ip_address: ipAddress,
|
||||||
|
}
|
||||||
|
next()
|
||||||
|
})
|
||||||
|
|
||||||
|
const featureFlagRouter = featureFlagsLoader(configModule, Logger)
|
||||||
|
|
||||||
|
const pgConnection = await pgConnectionLoader({ container, configModule })
|
||||||
|
|
||||||
|
container.register({
|
||||||
|
[ContainerRegistrationKeys.MANAGER]: asValue(dataSource.manager),
|
||||||
|
[ContainerRegistrationKeys.LOGGER]: asValue(Logger),
|
||||||
|
featureFlagRouter: asValue(featureFlagRouter),
|
||||||
|
[ContainerRegistrationKeys.CONFIG_MODULE]: asValue(configModule),
|
||||||
|
["remoteQuery"]: asValue(null),
|
||||||
|
})
|
||||||
|
|
||||||
|
await loadMedusaApp({
|
||||||
|
configModule,
|
||||||
|
container,
|
||||||
|
})
|
||||||
|
|
||||||
|
await expressLoader({ app: expressApp, configModule })
|
||||||
|
|
||||||
|
expressApp.use((req: Request, res: Response, next: NextFunction) => {
|
||||||
|
req.scope = container.createScope() as MedusaContainer
|
||||||
|
req.requestId = (req.headers["x-request-id"] as string) ?? v4()
|
||||||
|
next()
|
||||||
|
})
|
||||||
|
|
||||||
|
// TODO: Add Subscribers loader
|
||||||
|
|
||||||
|
await apiLoader({
|
||||||
|
container,
|
||||||
|
app: expressApp,
|
||||||
|
configModule,
|
||||||
|
featureFlagRouter,
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
container,
|
||||||
|
app: expressApp,
|
||||||
|
pgConnection,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default async ({
|
export default async ({
|
||||||
directory: rootDirectory,
|
directory: rootDirectory,
|
||||||
expressApp,
|
expressApp,
|
||||||
isTest,
|
isTest,
|
||||||
}: Options): Promise<{
|
}: Options): Promise<{
|
||||||
container: MedusaContainer
|
container: MedusaContainer
|
||||||
dbConnection: Connection
|
dbConnection?: Connection
|
||||||
app: Express
|
app: Express
|
||||||
pgConnection: unknown
|
pgConnection: unknown
|
||||||
}> => {
|
}> => {
|
||||||
|
if (process.env.MEDUSA_FF_MEDUSA_V2 == "true") {
|
||||||
|
return await loadMedusaV2({ directory: rootDirectory, expressApp })
|
||||||
|
}
|
||||||
|
|
||||||
const configModule = loadConfig(rootDirectory)
|
const configModule = loadConfig(rootDirectory)
|
||||||
|
|
||||||
const container = createMedusaContainer()
|
const container = createMedusaContainer()
|
||||||
|
|||||||
@@ -15,19 +15,15 @@ CREATE TABLE IF NOT EXISTS "region" (
|
|||||||
"deleted_at" timestamptz NULL,
|
"deleted_at" timestamptz NULL,
|
||||||
CONSTRAINT "region_pkey" PRIMARY KEY ("id")
|
CONSTRAINT "region_pkey" PRIMARY KEY ("id")
|
||||||
);
|
);
|
||||||
|
|
||||||
-- Adjust "region" table
|
-- Adjust "region" table
|
||||||
ALTER TABLE "region" DROP CONSTRAINT IF EXISTS "FK_3bdd5896ec93be2f1c62a3309a5";
|
ALTER TABLE "region" DROP CONSTRAINT IF EXISTS "FK_3bdd5896ec93be2f1c62a3309a5";
|
||||||
ALTER TABLE "region" DROP CONSTRAINT IF EXISTS "FK_91f88052197680f9790272aaf5b";
|
ALTER TABLE "region" DROP CONSTRAINT IF EXISTS "FK_91f88052197680f9790272aaf5b";
|
||||||
|
|
||||||
${generatePostgresAlterColummnIfExistStatement(
|
${generatePostgresAlterColummnIfExistStatement(
|
||||||
"region",
|
"region",
|
||||||
["tax_rate", "gift_cards_taxable", "automatic_taxes", "includes_tax"],
|
["tax_rate", "gift_cards_taxable", "automatic_taxes", "includes_tax"],
|
||||||
"DROP NOT NULL"
|
"DROP NOT NULL"
|
||||||
)}
|
)}
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS "IDX_region_deleted_at" ON "region" ("deleted_at") WHERE "deleted_at" IS NOT NULL;
|
CREATE INDEX IF NOT EXISTS "IDX_region_deleted_at" ON "region" ("deleted_at") WHERE "deleted_at" IS NOT NULL;
|
||||||
|
|
||||||
-- Create or update "region_country" table
|
-- Create or update "region_country" table
|
||||||
CREATE TABLE IF NOT EXISTS "region_country" (
|
CREATE TABLE IF NOT EXISTS "region_country" (
|
||||||
"id" text NOT NULL,
|
"id" text NOT NULL,
|
||||||
@@ -40,7 +36,6 @@ CREATE TABLE IF NOT EXISTS "region_country" (
|
|||||||
CONSTRAINT "region_country_pkey" PRIMARY KEY ("id")
|
CONSTRAINT "region_country_pkey" PRIMARY KEY ("id")
|
||||||
);
|
);
|
||||||
CREATE UNIQUE INDEX IF NOT EXISTS "IDX_region_country_region_id_iso_2_unique" ON "region_country" (region_id, iso_2);
|
CREATE UNIQUE INDEX IF NOT EXISTS "IDX_region_country_region_id_iso_2_unique" ON "region_country" (region_id, iso_2);
|
||||||
|
|
||||||
-- Adjust foreign keys for "region_country"
|
-- Adjust foreign keys for "region_country"
|
||||||
ALTER TABLE "region_country" DROP CONSTRAINT IF EXISTS "FK_91f88052197680f9790272aaf5b";
|
ALTER TABLE "region_country" DROP CONSTRAINT IF EXISTS "FK_91f88052197680f9790272aaf5b";
|
||||||
ALTER TABLE "region_country" ADD CONSTRAINT "region_country_region_id_foreign" FOREIGN KEY ("region_id") REFERENCES "region" ("id") ON UPDATE CASCADE;
|
ALTER TABLE "region_country" ADD CONSTRAINT "region_country_region_id_foreign" FOREIGN KEY ("region_id") REFERENCES "region" ("id") ON UPDATE CASCADE;
|
||||||
|
|||||||
@@ -31755,6 +31755,43 @@ __metadata:
|
|||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
|
"integration-tests-modules@workspace:integration-tests/modules":
|
||||||
|
version: 0.0.0-use.local
|
||||||
|
resolution: "integration-tests-modules@workspace:integration-tests/modules"
|
||||||
|
dependencies:
|
||||||
|
"@babel/cli": ^7.12.10
|
||||||
|
"@babel/core": ^7.12.10
|
||||||
|
"@babel/node": ^7.12.10
|
||||||
|
"@medusajs/api-key": "workspace:^"
|
||||||
|
"@medusajs/auth": "workspace:*"
|
||||||
|
"@medusajs/cache-inmemory": "workspace:*"
|
||||||
|
"@medusajs/customer": "workspace:^"
|
||||||
|
"@medusajs/event-bus-local": "workspace:*"
|
||||||
|
"@medusajs/inventory": "workspace:^"
|
||||||
|
"@medusajs/medusa": "workspace:*"
|
||||||
|
"@medusajs/modules-sdk": "workspace:^"
|
||||||
|
"@medusajs/pricing": "workspace:^"
|
||||||
|
"@medusajs/product": "workspace:^"
|
||||||
|
"@medusajs/promotion": "workspace:^"
|
||||||
|
"@medusajs/region": "workspace:^"
|
||||||
|
"@medusajs/store": "workspace:^"
|
||||||
|
"@medusajs/tax": "workspace:^"
|
||||||
|
"@medusajs/types": "workspace:^"
|
||||||
|
"@medusajs/user": "workspace:^"
|
||||||
|
"@medusajs/utils": "workspace:^"
|
||||||
|
"@medusajs/workflow-engine-inmemory": "workspace:*"
|
||||||
|
babel-preset-medusa-package: "*"
|
||||||
|
faker: ^5.5.3
|
||||||
|
jest: ^26.6.3
|
||||||
|
jest-environment-node: 26.6.2
|
||||||
|
medusa-fulfillment-webshipper: "workspace:*"
|
||||||
|
medusa-interfaces: "workspace:*"
|
||||||
|
medusa-plugin-sendgrid: "workspace:*"
|
||||||
|
pg: ^8.11.0
|
||||||
|
typeorm: ^0.3.16
|
||||||
|
languageName: unknown
|
||||||
|
linkType: soft
|
||||||
|
|
||||||
"integration-tests-plugins@workspace:integration-tests/plugins":
|
"integration-tests-plugins@workspace:integration-tests/plugins":
|
||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "integration-tests-plugins@workspace:integration-tests/plugins"
|
resolution: "integration-tests-plugins@workspace:integration-tests/plugins"
|
||||||
|
|||||||
Reference in New Issue
Block a user