Closed cbornet closed 8 years ago
Did you try H2 with disk-based persistence? This is what I do and I have your use-case working without doing anything :-)
You mean that when you add a field to an entity, the table gets recreated ? I need to test that.
Oh no, sorry: for that, I need to run "mvn liquibase:diff", but that doesn't work perfectly with H2, this is something that must be corrected. It works perfectly with MySQL and Postgresql, of course.
But doing a "yo jhipster:entity Foo" works perfectly in all cases -> with both BrowserSync and the devtools, that's one hell of a result!
@jdubois it doesn't work with a persistent RDMS when updating an entity (with H2 mem it does :smile: ). Anyway, it could even be interesting to have it even for persistent storage. I have started a project where each time the back-end dev creates/modifies an entity, they also add some dev dataset. So when other team members checkin, they instantly have sample data to work on
Sorry, you are correct. I understand your need for a dataset, isn't there something already existing to "dump" a database in Liquibase format? I remember having this with DBUnit, a long time ago.
Sorry I needed time to understand your need! Only trouble for me is that those tables would be empty by default (of course we can't know what you want to put inside), and many people wouldn't use them, and would have the performance hit of running those each time for nothing. As Liquibase is already making our boot time much longer, I'm really worried adding all those files.
I will do some tests to measure the performance impact. Also if you think those files will not benefit to enough people, I can certainly do it as a module.
OK, if you see how to do a module for it (I don't!!), can you do it that way? And then, if we see everyone wants this and that this isn't a performance issue, we can put it back in the main generator. It's a good way of testing ideas, instead of discussing :-)
+1 I also do this
I like to use in-memory H2 for dev as it plays magically with devtools : you regen an entity with a new field and the server reloads with the correct db schema in a few seconds. The disadvantage is that the DB is emptied during the process. So I use liquibase to load CSV files with sample data into my entities. So the question is : would it be interesting to create a CSV file with only the header line during the entity generation and the code to load it if the profile is dev in the existing liquibase xml changelog ?