Local database testing

Hi,

I’m curious what other people do with respect to the database when writing new code for a site that’s already live?

Before a site is live when im working on my local testing server i connect to a local version of my database. Once the site is live though this is not an option as i cant just download a copy of the latest live database and then upload when i am finished working on it as anything in-between on the live database would be lost. If i connect to the live database from my local testing server i cant go into my database and start editing things as it might break the live site. Im sure im missing some obvios method here?

Thanks!

If it requires a database change, I copy the database local, then write SQL scripts which can be run to make the appropriate changes. If it’s a lot of changes, I’ll reload the test database right before migrating to test the script to ensure it works completely.