updated migration tool
This commit is contained in:
parent
5c91e4c57c
commit
08f4c0d6e0
14
Dockerfile
14
Dockerfile
|
@ -119,6 +119,7 @@ COPY ./docker/www.conf /etc/php/$PHP_VERSION/fpm/pool.d/www.conf
|
||||||
|
|
||||||
# Add PHP Source Code
|
# Add PHP Source Code
|
||||||
COPY ./app /usr/share/nginx/html/app
|
COPY ./app /usr/share/nginx/html/app
|
||||||
|
COPY ./bin /usr/local/bin
|
||||||
COPY ./docs /usr/share/nginx/html/docs
|
COPY ./docs /usr/share/nginx/html/docs
|
||||||
COPY ./public /usr/share/nginx/html/public
|
COPY ./public /usr/share/nginx/html/public
|
||||||
COPY ./src /usr/share/nginx/html/src
|
COPY ./src /usr/share/nginx/html/src
|
||||||
|
@ -136,13 +137,10 @@ RUN mkdir -p /storage/uploads && \
|
||||||
# Supervisord Conf
|
# Supervisord Conf
|
||||||
COPY ./docker/supervisord.conf /etc/supervisord.conf
|
COPY ./docker/supervisord.conf /etc/supervisord.conf
|
||||||
|
|
||||||
# Start
|
# Executables
|
||||||
COPY ./docker/bin/start /start
|
RUN chmod +x /usr/local/bin/start
|
||||||
RUN chmod 775 /start
|
RUN chmod +x /usr/local/bin/migrate
|
||||||
|
RUN chmod +x /usr/local/bin/test
|
||||||
# Migrate
|
|
||||||
COPY ./docker/bin/migrate /migrate
|
|
||||||
RUN chmod 775 /migrate
|
|
||||||
|
|
||||||
# Letsencrypt Permissions
|
# Letsencrypt Permissions
|
||||||
RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/
|
RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/
|
||||||
|
@ -151,4 +149,4 @@ EXPOSE 80
|
||||||
|
|
||||||
WORKDIR /usr/share/nginx/html
|
WORKDIR /usr/share/nginx/html
|
||||||
|
|
||||||
CMD ["/bin/bash", "/start"]
|
CMD ["/bin/bash", "/usr/local/bin/start"]
|
||||||
|
|
|
@ -21,7 +21,7 @@ $callbacks = [
|
||||||
},
|
},
|
||||||
'0.5.0' => function($project) use ($db, $projectDB, $requset) {
|
'0.5.0' => function($project) use ($db, $projectDB, $requset) {
|
||||||
|
|
||||||
Console::info('Upgrading project: '.$project->getId());
|
Console::log('Migrating project: '.$project->getId());
|
||||||
|
|
||||||
// Update all documents $uid -> $id
|
// Update all documents $uid -> $id
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ $callbacks = [
|
||||||
|
|
||||||
$sum = count($all);
|
$sum = count($all);
|
||||||
|
|
||||||
Console::success('Fetched '.$sum.' (offset: '.$offset.' / limit: '.$limit.') documents from a total of '.$projectDB->getSum());
|
Console::log('Migrating: '.$offset.' / '.$projectDB->getSum());
|
||||||
|
|
||||||
foreach($all as $document) {
|
foreach($all as $document) {
|
||||||
$document = fixDocument($document);
|
$document = fixDocument($document);
|
||||||
|
@ -51,7 +51,6 @@ $callbacks = [
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$new = $projectDB->overwriteDocument($document->getArrayCopy());
|
$new = $projectDB->overwriteDocument($document->getArrayCopy());
|
||||||
Console::success('Updated document succefully');
|
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
Console::error('Failed to update document: '.$th->getMessage());
|
Console::error('Failed to update document: '.$th->getMessage());
|
||||||
continue;
|
continue;
|
||||||
|
@ -153,7 +152,7 @@ function fixDocument(Document $document) {
|
||||||
->removeAttribute('$uid')
|
->removeAttribute('$uid')
|
||||||
;
|
;
|
||||||
|
|
||||||
Console::log('Switched from $uid to $id: '.$document->getCollection().'/'.$document->getId());
|
//Console::log('Switched from $uid to $id: '.$document->getCollection().'/'.$document->getId());
|
||||||
|
|
||||||
foreach($document as &$attr) {
|
foreach($document as &$attr) {
|
||||||
if($attr instanceof Document) {
|
if($attr instanceof Document) {
|
||||||
|
@ -211,7 +210,7 @@ $cli
|
||||||
$sum = count($projects);
|
$sum = count($projects);
|
||||||
$offset = $offset + $limit;
|
$offset = $offset + $limit;
|
||||||
|
|
||||||
Console::success('Fetched '.$sum.' projects...');
|
Console::log('Fetched '.$sum.' projects...');
|
||||||
}
|
}
|
||||||
|
|
||||||
Console::success('Data Migration Completed');
|
Console::success('Data Migration Completed');
|
||||||
|
|
Loading…
Reference in a new issue