This is probably a simple question. I have a database that I’m using to store my users details. My app queries this db to determine if they get access or not.
During testing, if I wanted to change the structure of the db, such as adding a new column, I would simply DROP the tables and re-CREATE them. I don’t think I want to do that on a live system. How would I safely go about doing something like that?
Thanks
Generally I’ve tracked database changes in source control as such:
ALTER TABLEcommand in a script.When creating a database from scratch, everything is run (in order). When applying a change to a live database, only the deltas which haven’t been run are run. (Keeping track which ones have been run is an operations procedure, by tracking which revision of source control is in which environment.)
If the folder of deltas starts to become unmanageable, I imagine you can re-baseline the create scripts from time to time. It’s probably not a bad idea just as a sanity check to make sure things haven’t been introduced into the system without being properly tracked.