Howdy all, I am trying to wrap my head around the ...
# help
s
Howdy all, I am trying to wrap my head around the responsibilities of
onCreate
/
onUpdate
/
onDelete
in the context of the
sst.Script
. I am looking to run DB migrations on each deploy. Do I have to mount the lambda against the
onCreate
and
onUpdate
properties? It is a bit confusing as the docs state that "It gets run on every deployment."
f
Hey @Sean Matheson, is ur DB DynamoDB, RDS, or something else?
yeah, you would use both
onCreate
and
onUpdate
in this case.
onCreate
gets run on the first run, and
onUpdate
gets run on each subsequent deploy.
s
Ok, so it's relating to the create of the underlying Script.
Makes sense, thank you
👍
d
@Frank, just to clarify,
sst.Script
works differently than
cdk.CustomResource
? The latter has
onUpdate
run during create AND updates: @aws-cdk/custom-resources module · AWS CDK (amazon.com)
f
Oh i see… did realize that. Yeah,
Script.onUpdate
doesn’t get called on create.
s
Excellent thanks