Skip to content

Commit 5776c0e

Browse files
authored
Fix: do not use dynamic file migrator in production (#1508)
1 parent 9f74d83 commit 5776c0e

File tree

1 file changed

+6
-4
lines changed
  • packages/resources/assets/RDS/migrator

1 file changed

+6
-4
lines changed

packages/resources/assets/RDS/migrator/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use strict";
22

33
import path from "path";
4-
import { Kysely, Migrator, NO_MIGRATIONS } from "kysely";
4+
import { Kysely, Migrator, NO_MIGRATIONS, FileMigrationProvider } from "kysely";
55
import { DataApiDialect } from "kysely-data-api";
66
import RDSDataService from "aws-sdk/clients/rdsdataservice";
77
import url from "url";
@@ -21,9 +21,11 @@ export async function handler(evt) {
2121

2222
const migrator = new Migrator({
2323
db,
24-
provider: new DynamicFileMigrationProvider(
25-
path.resolve(process.env.RDS_MIGRATIONS_PATH)
26-
),
24+
provider: process.env.LAMBDA_TASK_ROOT
25+
? new FileMigrationProvider(path.resolve(process.env.RDS_MIGRATIONS_PATH))
26+
: new DynamicFileMigrationProvider(
27+
path.resolve(process.env.RDS_MIGRATIONS_PATH)
28+
),
2729
});
2830

2931
if (!evt.type || evt.type === "latest") {

0 commit comments

Comments
 (0)