Comments (8)
Hello Josh,
I'm really glad you like the tool. Unfortunately, no, I don't think I will be implementing rollbacks anytime soon. Having a rollback feature would involve having to actually analyze the differences between two schema objects, while this tool is, at its core, nothing more than an SQL script manager. Also, since there is no restriction on what your revision scripts contain (you could write a revision script that inserts records in a table, without altering the schema in any way), it would mean that the app would also have to able to also generate diffs of the actual data inside your database, which is even harder to do, especially if you have tons of records.
from dbv.
Would it not be possible as you write the revision scripts you write a rollback script that undoes what you are doing. Then if we know where the user is and they want to rollback to a particular version it runs those scripts in reverse.
It obviously wouldn't be able to take into account data but for schema it would work really well.
from dbv.
Yes, flagging rollback scripts as such and running them backwards would probably work, at least from a technical point of view. The more elegant method would be to save snapshots for each schema object involved in a revision script, and then analyze the difference between the snapshots and the current version of a schema object. Writing about it here and thinking about it, the feature starts to seem more and more appealing to me, even though it would complicate each DBMS adapter greatly.
I've added this issue to the 2.0 milestone, thank you very much for suggesting it!
from dbv.
Cool - looking forward to it!!
from dbv.
We have a very similar tool (almost exactly the same) and we have a rollback feature too :)
How we did it is that we capture the time stamp of each new schema addition and we only allow upgrade / downgrade linearly either forward or backward in time.
Each developer must provide an upgrade SQL statement and a downgrade one. So each commit will have 2 SQL statements.
For ex. we have 4 commits:
Commit 1
Commit 2
Commit 3
Commit 4
Developer A is at commit 2, therefore he can only upgrade to commit 3 or downgrade to commit 1.
He cannot upgrade from commit 2 directly to commit 4 without running commit 3. Although we have an 'auto upgrade to current' feature, which runs each commit up until the current commit.
Same with downgrades.
We're using our tool for almost a year now, and I can say from experience that the downgrade / rollback was used very rarely, although it's a nice feature to have.
from dbv.
That's cool, so it's pretty much the same approach that @jmoont suggested. Isn't creating two SQL scripts for every database change a hassle? The flow must be something like this: first you write the upgrade script, then you remove / undo every change you made, save the resulting script, then run the upgrade script again on your own database. Am I right?
from dbv.
Something like that, but the SQL scripts are very granular. We have a rule that each SQL upgrade must contain only 1 SQL statement.
Creating both scripts are easy, especially once you created the upgrade script. Usually it takes less than 5 minute for each commit...
Most of the work are usually when we begin a project, and at the schema design phases. Later on in the project development when the schema is designed, the tool is used more rarely...
from dbv.
I'm excited about this feature! Would the rollback feature also work for when you're switching between branches in git? And would you have to write 2 SQL statements by hand each time to be able to rollback?
from dbv.
Related Issues (20)
- All On Disk set to "No" HOT 3
- Feedback for errors in Revision scripts HOT 3
- Is this project abandoned? HOT 1
- data changes
- why it it too slow? HOT 1
- HTTP Authentication not working HOT 2
- use multiple databases
- GitHub - Integration
- Need for other Adapters?
- Website is currently down HOT 1
- Question for sigle user (From newbie)
- Problem: Same name for stored procedures and tables
- How to configure sql server adapter?
- Expired certificate on https://dbv.vizuina.com/ HOT 1
- Integration with dbdiff HOT 2
- css attempts to load google font over http HOT 1
- Suggestion for non-linear changes
- [Question] [Best Practices] Should I create a revision too when I create a new table
- [Question] [Best Practices] How to store initialization data for tables
- Cannot see the project website HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbv.