When deploying a web application working with a database, is it correct to initialize (create, layouts, tables, populations) in the application itself or do it manually or through a script on the server?
- onein the migration system. scheme and see. - Invision
2 answers
Through the system of migrations - a tool designed to change the structure of the database. The most popular for Java are Liquibase and Flyweight (although the second one cannot be fully described as a migration system).
Filling the database needs to be done through a separate system (the so-called seed), but I have not seen such utilities for java.
If you do it all by hand, then sooner or later you will encounter the fact that the database versions in development and production do not match each other, and finding the difference will not be so easy.
It is possible to fill the tables this way and that, it doesn't matter. But the creation of a table structure in a database is best done manually. As for me it is so much faster and easier to solve troubles arising along the way