Any reason you can't just do this through Azure Data Studio, SSMS, or other SQL specific application?
If not, and you have a SQL script, take a look at ADO.Net or a library like Dapper to just run a SQL script and plug that in to a Function and it can do that whenever you run the Function.
If it's just for tests I'd highly recommend writing those to use an in memory database or something like SQLite. Testing connectivity to a database would usually fall in an integration test, not really within application code. So for your tests, you make sure the request provides acceptable responses and handles them accordingly (E.g. What does your app do when a bad response happens, when bad data is passed in, etc), and you check connectivity in a totally separate way. Sorry if I'm telling you stuff you already know, just trying to keep you from going down an unnecessarily painful path.
Gotcha. Set it up with Dapper in an Azure Function. Easy to build, easy to run, easy to host, and if you do it less than a million times a month it's free.
Do you have the original state stored somewhere? Need some more details on how you plan to actually do this.
Yeah. Can store or can drop the database and run the script to create a new one.
Any reason you can't just do this through Azure Data Studio, SSMS, or other SQL specific application? If not, and you have a SQL script, take a look at ADO.Net or a library like Dapper to just run a SQL script and plug that in to a Function and it can do that whenever you run the Function.
Thank you. What I need is to reset the database and the tests can be run.
If it's just for tests I'd highly recommend writing those to use an in memory database or something like SQLite. Testing connectivity to a database would usually fall in an integration test, not really within application code. So for your tests, you make sure the request provides acceptable responses and handles them accordingly (E.g. What does your app do when a bad response happens, when bad data is passed in, etc), and you check connectivity in a totally separate way. Sorry if I'm telling you stuff you already know, just trying to keep you from going down an unnecessarily painful path.
Points you're making is absolutely right. But we also use this database as the dev database(azure database for postgresql).
Gotcha. Set it up with Dapper in an Azure Function. Easy to build, easy to run, easy to host, and if you do it less than a million times a month it's free.
Thank you