mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-24 07:42:40 +01:00
(stable) Allow bin/storage renamespace
to work with underscores
If the namespace is something like "test_example" we currently fail to renamespace the dump. (Cowboy committing this since this is currently blocking a data export.) Test Plan: - Renamespaced a local dump, examined the output, saw 60 create / 60 use, reimported it. - Will export in production. Auditors: chad
This commit is contained in:
parent
ca30df847e
commit
bac8562884
1 changed files with 4 additions and 12 deletions
|
@ -138,9 +138,11 @@ final class PhabricatorStorageManagementRenamespaceWorkflow
|
||||||
$output_name));
|
$output_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$name_pattern = preg_quote($from, '@');
|
||||||
|
|
||||||
$patterns = array(
|
$patterns = array(
|
||||||
'use' => '@^(USE `)([^_]+)(_.*)$@',
|
'use' => '@^(USE `)('.$name_pattern.')(_.*)$@',
|
||||||
'create' => '@^(CREATE DATABASE /\*.*?\*/ `)([^_]+)(_.*)$@',
|
'create' => '@^(CREATE DATABASE /\*.*?\*/ `)('.$name_pattern.')(_.*)$@',
|
||||||
);
|
);
|
||||||
|
|
||||||
$found = array_fill_keys(array_keys($patterns), 0);
|
$found = array_fill_keys(array_keys($patterns), 0);
|
||||||
|
@ -151,16 +153,6 @@ final class PhabricatorStorageManagementRenamespaceWorkflow
|
||||||
|
|
||||||
foreach ($patterns as $key => $pattern) {
|
foreach ($patterns as $key => $pattern) {
|
||||||
if (preg_match($pattern, $line, $matches)) {
|
if (preg_match($pattern, $line, $matches)) {
|
||||||
$namespace = $matches[2];
|
|
||||||
if ($namespace != $from) {
|
|
||||||
throw new Exception(
|
|
||||||
pht(
|
|
||||||
'Expected namespace "%s", found "%s": %s.',
|
|
||||||
$from,
|
|
||||||
$namespace,
|
|
||||||
$line));
|
|
||||||
}
|
|
||||||
|
|
||||||
$line = $matches[1].$to.$matches[3];
|
$line = $matches[1].$to.$matches[3];
|
||||||
$found[$key]++;
|
$found[$key]++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue