extract migrate task

This commit is contained in:
Daniel Seifert 2024-10-17 08:54:34 +02:00
parent 27f664ac51
commit eb855ef6c3
2 changed files with 15 additions and 9 deletions

View File

@ -39,8 +39,9 @@ This command set `current` directory to previous deployment:
## Available tasks ## Available tasks
* dep `deploy` [stage] - create a new release for defined stage - dep `deploy` [stage] - create a new release for defined stage
* dep `rollback` [stage] - switch to previous release - dep `rollback` [stage] - switch to previous release
- dep `migrate`[stage] - run all database migrations
* dep `duplicateDatabase` [stage] - dump contents from source database (live) to destination database (stage) and replace live to stage URLs * dep `duplicateDatabase` [stage] - dump contents from source database (live) to destination database (stage) and replace live to stage URLs
* dep `getVersion` [stage] - show version of current WordPress installation * dep `getVersion` [stage] - show version of current WordPress installation

View File

@ -16,13 +16,17 @@ after('deploy:vendors', 'deploy:d3OxidTasks');
desc('Oxid related tasks'); desc('Oxid related tasks');
task('deploy:d3OxidTasks', [ task('deploy:d3OxidTasks', [
'deploy:clear_paths', 'deploy:clear_paths'
'deploy:setShopsOffline', ]);
'deploy:setShopsOnline'
desc('run all database migrations');
task('migrate', [
'migrate:setShopsOffline',
'migrate:setShopsOnline'
]); ]);
desc('set shops offline'); desc('set shops offline');
task('deploy:setShopsOffline', function() { task('migrate:setShopsOffline', function() {
if (has('bin/mysql') && strlen(get('bin/mysql')) && if (has('bin/mysql') && strlen(get('bin/mysql')) &&
has('db_name') && strlen(get('db_name')) && has('db_name') && strlen(get('db_name')) &&
has('db_conf_path') && strlen(get('db_conf_path')) && test("[ -f {{db_conf_path}} ]") has('db_conf_path') && strlen(get('db_conf_path')) && test("[ -f {{db_conf_path}} ]")
@ -32,10 +36,10 @@ task('deploy:setShopsOffline', function() {
} else { } else {
info('missing config, task skipped'); info('missing config, task skipped');
} }
})->select('role=production,role=stage'); });
desc('set shops online'); desc('set shops online');
task('deploy:setShopsOnline', function() { task('migrate:setShopsOnline', function() {
if (has('bin/mysql') && strlen(get('bin/mysql')) && if (has('bin/mysql') && strlen(get('bin/mysql')) &&
has('db_name') && strlen(get('db_name')) && has('db_name') && strlen(get('db_name')) &&
has('db_conf_path') && strlen(get('db_conf_path')) && test("[ -f {{db_conf_path}} ]") has('db_conf_path') && strlen(get('db_conf_path')) && test("[ -f {{db_conf_path}} ]")
@ -45,4 +49,5 @@ task('deploy:setShopsOnline', function() {
} else { } else {
info('missing config, task skipped'); info('missing config, task skipped');
} }
})->select('role=production,role=stage'); });