Author: Anian Ziegler Language: text
Description: A question about database migrations Timestamp: 2017-08-15 21:48:06 +0000
View raw paste Reply
  1. Hello Dan and Wes,
  2.  
  3. First up I have to say I really like your show and in fact I'm listening to nearly all JB Shows on a daily basis. I've learned a lot about Linux, security and the OpenSource world. So thank you very much for all the work you are doing.
  4.  
  5. Now to my question:
  6.  
  7. I'm building web applications with PostgreSQL as a database in the backend. From one of my previous project I had learned about so called database migrations in the Laravel Schema builder (https://laravel.com/docs/5.4/migrations) Luckily I don't have to use PHP any more and found a similar solution for NodeJS (http://knexjs.org/#Migrations). The basic idea is, that you provide the changes you want to make to the database schema in JavaScript using a query builder. These changes are then translated into proper SQL statements for postgres or MySql and applied to the database. Each set of changes is described in a separate file with a time stamp attached to it and you also provide queries for rolling back the changes you described. So it's somewhat like a version control for your database.
  8.  
  9. I really like the tools knex provides me with but I would love to have some more features like getting a description of the current schema or even a diff between two migrations. Do you know of any tools that do something like that? Do you keep a database structure under version control and how would you do that?
  10.  
  11. Because I'm only using postgres I wouldn't mind losing the compatibility to other database formats like MySql. But until now I haven't found any simple tools, would allow for easily developing and deploying my database schema step by step. It would be awesome to here your take on that.
  12.  
  13. Greetings and all the best for the future from Germany,
  14.  
View raw paste Reply