mrfreester
mrfreester

Reputation: 1991

Export SQL Database Changes Made Over Time

We're setting up a test environment to run automated tests against.

We wanted to have a clean environment, so everytime code is checked in we blow away the database, create a new one from scratch, and populate it with data from a .sql script.

What I would like, since I'm lazy, is a way for someone to make changes using the UI that change things in the database, and then just export the changes that were made into a .sql script that we can add to the base script when the db is created.

Does anybody know if there is a way to start detecting any changes made to the db and export those into a sql script?

I've done a basic search for this and if it exists I must not be searching the right terms. Thanks :)

Upvotes: 1

Views: 709

Answers (1)

hkf
hkf

Reputation: 4520

There are third party tools that are able to do what you asked for, specifically RedGate SQL Compare http://www.red-gate.com/products/sql-development/sql-compare/ (Note, I am not affiliated with RedGate in any way).

Otherwise aside from creating ON INSERT/ON DELETE/ON UPDATE CASCADE triggers for every single table I don't really see a neat way of doing it.

Edit: Totally forgot about triggers and stored procs. They would not be covered by CASCADE triggers.

Upvotes: 2

Related Questions