Some time ago, at work, we had to change our main system to "cross-rdbms". Iβm not sure if this is the right term, but basically the system worked only with MSSQLServer, but in order to adapt the new client, we had to let the system work with both MSSQLServer and Oracle.
We do not use ORM due to reasons. Instead, we use a custom level of data access based on ADO.
Prior to this change, we relied heavily on stored procedures, database functions, triggers, etc. A significant part of the business logic was in the database itself.
We decided to get rid of all stored procedures, triggers, etc. and basically reduce to a database at a simple storage level.
To handle migrations, we created a .json file that contains a view of our database schema: tables, columns, indexes, constraints, etc. A simple application was created to edit this file. Using it, we can edit existing tables and columns and add new ones.
This json file is versioned in our repository. When the application is executed, the program reads the file, creating a view of the database in memory. Then it reads the metadata from the actual database, compares it with the representation in memory, and generates scripts based on the differences found.
Finally, the scripts are executed, updating the database schema.
, . , :
- POCO, ;
- , , /;
- , , , .
, POCO json . , , .
, , , Clean Architecture/Onion Domain Driven Design.
DDD, , , , .
, : , DRY , ?