Omi Chowdhury
06/22/2021, 2:43 AMthdxr
06/22/2021, 2:50 AMthdxr
06/22/2021, 2:51 AMexport const trigger: CloudFormationCustomResourceHandler = async (
event,
_ctx
) => {
if (event.RequestType === "Delete") return
const result = execSync(
`${process.execPath} /opt/nodejs/node_modules/prisma/build/index.js migrate deploy --preview-feature`,
{
env: {
DATABASE_URL: Config.postgres.url(),
},
}
)
console.log(result.toString())
}
Omi Chowdhury
06/22/2021, 3:01 AMOmi Chowdhury
06/22/2021, 3:02 AMforeach tenant
foreach sub-object
foreach sub-sub-object
query for value
save value
where each foreach is a paginated dynamo query that could be pretty largeOmi Chowdhury
06/22/2021, 3:03 AMthdxr
06/22/2021, 3:39 AMthdxr
06/22/2021, 3:39 AMFrank
thdxr
06/22/2021, 3:40 AMthdxr
06/22/2021, 3:41 AMAshishkumar Pandey
06/22/2021, 4:08 AMmongo-migrate-ts
. I definitely want to plug it into my deployments via sst and seed but currently I’ve no idea how.Omi Chowdhury
06/22/2021, 2:21 PMFrank
Frank
thdxr
06/24/2021, 8:28 PMFrank
sst deploy
(kind of like adding a before deploy/after deploy hook).thdxr
06/24/2021, 8:30 PMFrank
Frank
Omi Chowdhury
06/24/2021, 9:44 PMOmi Chowdhury
06/24/2021, 9:45 PMOmi Chowdhury
06/24/2021, 9:46 PMFrank
new sst.Run(this, "DBMigration", {
script: "src/migrations/script.main",
});
It basically creates a Lambda function with the script code and a CloudFormation custom resource that runs the Lambda function on CloudFormation deployment.Frank
Omi Chowdhury
06/24/2021, 10:19 PMFrank
Omi Chowdhury
06/24/2021, 10:25 PMOmi Chowdhury
06/24/2021, 10:26 PMOmi Chowdhury
06/24/2021, 10:27 PMFrank
Frank
Frank
Omi Chowdhury
06/24/2021, 10:41 PMOmi Chowdhury
06/24/2021, 10:42 PM