Refactor migrate / install scripts to keep up to SRP
See original GitHub issueeko@eko-GE62VR-6RF:~/Schreibtisch/vue-storefront-api$ npm run migrate
> vue-storefront-api@0.1.0 migrate /home/eko/Schreibtisch/vue-storefront-api
> node node_modules/migrate/bin/migrate
Elasticsearch INFO: 2018-03-05T20:07:01Z
Adding connection to http://localhost:9200/
up : 1513603161654-reindex.js
Elasticsearch DEBUG: 2018-03-05T20:07:01Z
starting request {
"method": "POST",
"path": "/_reindex",
"body": {
"source": {
"index": "vue_storefront_catalog_temp"
},
"dest": {
"index": "vue_storefront_catalog"
}
},
"query": {}
}
Elasticsearch DEBUG: 2018-03-05T20:07:01Z
Request complete
{ Error: [index_not_found_exception] no such index, with { resource.type="index_or_alias" & resource.id="vue_storefront_catalog_temp" & index_uuid="_na_" & index="vue_storefront_catalog_temp" }
at respond (/home/eko/Schreibtisch/vue-storefront-api/node_modules/elasticsearch/src/lib/transport.js:307:15)
at checkRespForFailure (/home/eko/Schreibtisch/vue-storefront-api/node_modules/elasticsearch/src/lib/transport.js:266:7)
at HttpConnector.<anonymous> (/home/eko/Schreibtisch/vue-storefront-api/node_modules/elasticsearch/src/lib/connectors/http.js:159:7)
at IncomingMessage.bound (/home/eko/Schreibtisch/vue-storefront-api/node_modules/elasticsearch/node_modules/lodash/dist/lodash.js:729:21)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1055:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
status: 404,
displayName: 'NotFound',
message: '[index_not_found_exception] no such index, with { resource.type="index_or_alias" & resource.id="vue_storefront_catalog_temp" & index_uuid="_na_" & index="vue_storefront_catalog_temp" }',
path: '/_reindex',
query: {},
body:
{ error:
{ root_cause: [Array],
type: 'index_not_found_exception',
reason: 'no such index',
'resource.type': 'index_or_alias',
'resource.id': 'vue_storefront_catalog_temp',
index_uuid: '_na_',
index: 'vue_storefront_catalog_temp' },
status: 404 },
statusCode: 404,
response: '{"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"vue_storefront_catalog_temp","index_uuid":"_na_","index":"vue_storefront_catalog_temp"}],"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"vue_storefront_catalog_temp","index_uuid":"_na_","index":"vue_storefront_catalog_temp"},"status":404}',
toString: [Function],
toJSON: [Function] }
error : [index_not_found_exception] no such index, with { resource.type="index_or_alias" & resource.id="vue_storefront_catalog_temp" & index_uuid="_na_" & index="vue_storefront_catalog_temp" } :: {"path":"/_reindex","query":{},"body":"{\"source\":{\"index\":\"vue_storefront_catalog_temp\"},\"dest\":{\"index\":\"vue_storefront_catalog\"}}","statusCode":404,"response":"{\"error\":{\"root_cause\":[{\"type\":\"index_not_found_exception\",\"reason\":\"no such index\",\"resource.type\":\"index_or_alias\",\"resource.id\":\"vue_storefront_catalog_temp\",\"index_uuid\":\"_na_\",\"index\":\"vue_storefront_catalog_temp\"}],\"type\":\"index_not_found_exception\",\"reason\":\"no such index\",\"resource.type\":\"index_or_alias\",\"resource.id\":\"vue_storefront_catalog_temp\",\"index_uuid\":\"_na_\",\"index\":\"vue_storefront_catalog_temp\"},\"status\":404}"}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-storefront-api@0.1.0 migrate: `node node_modules/m
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Refactor migrate / install scripts to keep up to SRP #28 - GitHub
Migrate script should be always at the end as there is a possibility that for example some migrations are adding specific Elastic data...
Read more >Refactoring for SRP - SymfonyCasts
The first thing I want to do is rename register() to create() ... or you could use save() ... or even rename the...
Read more >About the migration strategies - AWS Prescriptive Guidance
There are seven migration strategies for moving applications to the cloud, known as the 7 Rs: Retire. Retain. Rehost. Relocate. Repurchase. Replatform. Refactor...
Read more >Migration from Entity Framework into Dapper - jtabuloc blog
Create a library project that will manage all migration scripts. This project must only contain migration scripts, and the only responsibility ...
Read more >Refactoring - Unity - Manual
In order to fix it, you can reopen the script file and map the new name to the previous name with the [RenamedFrom]...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@daaru00 good point. I’ll check it. I think it should be modified - you’re right; I mean - migrations shouldn’t be related to the
restore script
. You could modify it if You like.To do so You probably need to modify the installation procedure (core/scripts/installer.js + README file) and the
npm run restore
to sth like this:First variant - to use the default data set - to be used by the installer:
Second variant - to use the tempty data set - to be available for the manual installation:
Migrate script should be always at the end as there is a possibility that for example some migrations are adding specific Elastic data entities that were not available in the dump.
vue_storefront_catalog_temp is created by npm run restore command and then after the migration ran its deleted
So after you run the vue-storefront installer - you will be not able to re-run the migrations without running the first step - npm run restore