In MixERP, we do not create a large SQL and maintain it. This process is buggy, error-prone, and difficult to manage. You might not have heard about SQL bundling before, but we do just that.
What is SQL bundling?
SQL bundling is nothing more than a process where you will:
- Create many individual sql files
- Organize them logically in a directory structure
- Work on one thing at a time, focus on everything later
- Bundle them all together to create a giant SQL file
How Does This Even Work?
- an organized directory structure where we store files
- SQL (*.sql) files
- Sample (*.sql.sample) files
- Optional (*.optional) files
Wait, sqlbundle comes first!
If you did notice, we have a special tiny file mixerp.sqlbundle in the directory
This is a YAML file
- default-language : - script-directory : db/1.x/1.1/src - output-directory:db/1.x/1.1/
This file is used as a configuration file by the utility MixERP.Net.Utility.SqlBundler, which will create a bundled SQL file for us.
MixERP.Net.Utility.SqlBundler.exe [path/to/root] [path/to/sqlbundle-file] [include-optional=false] [include-sample=false]
SQL (*.sql) Files
Each of the .sql will be bundled to create a large sql-bundle file, which is nothing more than a plain sql file. The .sql files have the primary priority to get included on a bundled file.
Sample (*.sql.sample) Files
These files will only be included when the flag [include-sample] is set to true. We use this flag for development purpose to create a new sample file by using it along with pg_dump to include us some data. This has the secondary priority to get included on the bundled file. This file is recommended for evaluation purpose only.
Optional (*.optional) Files
These files will only be included when the flag [include-optional] is set to true. An optional file would have a lower priority. Please search for existing *.optional file(s) to see how exactly we use this.
The following files would be useful for database developers to review: