hm I guess I only need this for non-local developm...
# sst
t
hm I guess I only need this for non-local development where this isn't an issue
f
Hey @thdxr From what I’ve gathered, most folks do something like this. Per se you have a table called Posts, and you want to run change its schema. The migration steps are along the line of: 1. create a new table Posts2 2. deploy code to read from Posts, but always write to both Posts and Posts2 (so for any new items, Posts and Posts2 are in-sync) 3. run the migration lambda to fill up old content 4. deploy code again to read/write to Posts2 5. drop table Posts
And for the context of SST, if you are running
sst start
, in step 3, the migration lambda runs your local function.
I’m not sure if this is what you were asking. 😁
t
When I referenced migrations I meant schema migrations in Postgres. For example if I want to add a column, I need that to happen before any new lambda code referencing it runs
So what I was hoping for was a function I could deploy first before updating any code that executes once to add the column
Think I'm able to do that with cdk custom resources but still playing with it
m
@thdxr I think this would be a good fit for a code pipeline stage as part of ci/cd. Locally I’m sure you could run the migration manually. Otherwise I think what @Frank said is pretty common. You could replace table with column in his example.
t
Let me look into codepipeline haven't used it before
I basically was trying to see if I can do everything through a lambda so I didn't have to worry about vpn/vpc access in my CI environment
m
I’m sure a release phase could call a lambda.
t
Yeah that's kind of what I was thinking earlier where I have a sst app just for my migrations that gets deployed then invoked before my main application gets deployed
m
I’d like hear what you settle on!