Glad to see that my efforts help people.
It deletes all the roles, udf etc. before calling delete on the database.
That’s not exactly what the code is doing (or I might have made a small logic mistake). There are actually two ways the logic in the setup/destroy scripts work for my own convenience while working on it:
The first has the disadvantage that that requires extra explanation, it basically uses a key of a parent database and the whole application works on a child database that is created in that parent database. I use a child database to make sure that if I nuke the database I don’t lose the admin key which I use for the setup scripts.
The second is the default and has the disadvantage that you have to wait for ±60 seconds for cached roles/function names to disappear since you are reusing the same database.
- Is this the recommended way and why?
I assume this is less relevant due to my answer on the previous question. But to be clear, all of this is my approach. At this point, we do not have a recommended official way to destroy/setup or define resources in a IaaC way. One of the articles I’d like to write will be about that, I think we can still improve much of the current Fwitter approach there. In that case, I’ll touch base with our engineering team to see whether my recommendations could be considered official. Until now, consider it as my approach that made sense to me.
Ideally I’d like to know if its possible to be charged storage for deleted data etc?
Not sure what you mean?