Simple implementation of migration collection, ideas written down. aims to be easy for use, easy to be extended.
currently only filesystem, mssql, mariadb, postgres migration is implemented
NOTE: every component can be redefined and added instead of default one
feeder
- feeds with data collection, reads files from fs, and filters them based on extensionsorter
- sorts files based on it integer key eg. if file name is121_abc.sql
, integer keys is121
importer
- imports migration fileparser
- parses imported fileledger
- do the migration, acquire locks, check if migration is executed, execute it, and write it downend
executes at the end, no mather if error was raised or migration succeeded
all of them should return following structure
[
{
"baseName": "1_bca.sql",
"path": "tests/unit/runtime/migration",
"content": [
"--------------UP",
"SELECT 'up'",
"--------------DOWN",
"SELECT 'down'"
],
"parsed": {
"up": "SELECT 'up'",
"down": "SELECT 'down'"
},
"migrated": false
},
{
"baseName": "2_abc.sql",
"path": "tests/unit/runtime/migration",
"content": [
"--------------UP",
"SELECT 'up'",
"--------------DOWN",
"SELECT 'down'"
],
"parsed": {
"up": "SELECT 'up'",
"down": "SELECT 'down'"
},
"migrated": true
},
{
"baseName": "5_abc.sql",
"path": "tests/unit/runtime/migration",
"content": [
"--------------UP",
"SELECT 'up'",
"--------------DOWN",
"SELECT 'down'"
],
"parsed": {
"up": "SELECT 'up'",
"down": "SELECT 'down'"
},
"migrated": true
},
{
"baseName": "123_abc.sql",
"path": "tests/unit/runtime/migration",
"content": [
"--------------UP",
"SELECT 'up'",
"--------------DOWN",
"SELECT 'down'"
],
"parsed": {
"up": "SELECT 'up'",
"down": "SELECT 'down'"
},
"migrated": true
}
]