diff --git a/db/dataSource.ts b/db/dataSource.ts index 996e40701f4..b30e387d3ed 100644 --- a/db/dataSource.ts +++ b/db/dataSource.ts @@ -14,7 +14,7 @@ export const dataSource = new DataSource({ username: GRAPHER_DB_USER || "root", password: GRAPHER_DB_PASS || "", database: GRAPHER_DB_NAME, - entities: ["itsJustJavascript/db/model/**/!(*.test).js"], - migrations: ["itsJustJavascript/db/migration/**/!(*.test).js"], + entities: ["db/model/**/!(*.test).ts"], + migrations: ["db/migration/**/!(*.test).ts"], charset: "utf8mb4", }) diff --git a/db/tests/dataSource.dbtests.ts b/db/tests/dataSource.dbtests.ts index 744fd2de5d8..75c7291fa81 100644 --- a/db/tests/dataSource.dbtests.ts +++ b/db/tests/dataSource.dbtests.ts @@ -14,7 +14,7 @@ export const dataSource = new DataSource({ username: GRAPHER_TEST_DB_USER || "root", password: GRAPHER_TEST_DB_PASS || "", database: GRAPHER_TEST_DB_NAME, - entities: ["itsJustJavascript/db/model/**/!(*.test).js"], - migrations: ["itsJustJavascript/db/migration/**/!(*.test).js"], + entities: ["db/model/**/!(*.test).ts"], + migrations: ["db/migration/**/!(*.test).ts"], charset: "utf8mb4", }) diff --git a/db/tests/run-db-tests.sh b/db/tests/run-db-tests.sh index 26b73b249a7..ff4351f6127 100755 --- a/db/tests/run-db-tests.sh +++ b/db/tests/run-db-tests.sh @@ -19,7 +19,7 @@ docker compose -f docker-compose.dbtests.yml up -d echo '==> Running migrations' -yarn tsx node_modules/typeorm/cli.js migration:run -d db/tests/dataSource.dbtests.ts +yarn tsx --tsconfig tsconfig.tsx.json node_modules/typeorm/cli.js migration:run -d db/tests/dataSource.dbtests.ts echo '==> Running tests' if ! yarn run jest --config=jest.db.config.js --runInBand # runInBand runs multiple test files serially - useful to avoid weird race conditions diff --git a/package.json b/package.json index f597f635dc7..9e6b29f3f4c 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,9 @@ "fixLint": "eslint . --fix", "fixPrettierAll": "yarn prettier --write \"**/*.{tsx,ts,jsx,js,json,md,html,css,scss,yml}\"", "runRegionsUpdater": "tsx --tsconfig tsconfig.tsx.json devTools/regionsUpdater/update.ts", - "runDbMigrations": "tsx node_modules/typeorm/cli.js migration:run -d db/dataSource.ts", + "runDbMigrations": "tsx --tsconfig tsconfig.tsx.json node_modules/typeorm/cli.js migration:run -d db/dataSource.ts", "refreshPageviews": "tsx --tsconfig tsconfig.tsx.json db/refreshPageviewsFromDatasette.ts", - "revertLastDbMigration": "tsx node_modules/typeorm/cli.js migration:revert -d db/dataSource.ts", + "revertLastDbMigration": "tsx --tsconfig tsconfig.tsx.json node_modules/typeorm/cli.js migration:revert -d db/dataSource.ts", "startAdminServer": "node --enable-source-maps ./itsJustJavascript/adminSiteServer/app.js", "startAdminDevServer": "tsx watch --tsconfig tsconfig.tsx.json adminSiteServer/app.tsx", "startLocalCloudflareFunctions": "wrangler pages dev localBake --compatibility-date 2023-10-09",