Closed nonumpa closed 2 years ago
Migration report on staging
Update article schema (in rumors-db
)
$ npm run reload -- articles
> rumors-db@1.0.2 reload
> babel-node db/reloadSchema.js "articles"
Source: articles_v1_1_0
Target: articles_v1_2_0
Reindexed from articles_v1_1_0 to articles_v1_2_0 in 39 seconds.
Setup articles_v1_2_0 -> articles alias and remove articles_v1_1_0.
Fill in article type: call
curl -XPOST "{db_url}/articles_{vesrion}/_update_by_query" -H 'Content-Type: application/json' -d'
{
"script": {
"source": "ctx._source[\"articleType\"]=\"TEXT\";",
"lang": "painless"
},
"query": {
"bool": {
"must_not": {
"exists": {
"field": "articleType"
}
}
}
}
}'
took 53 second on 67k articles
{"took":53524,"timed_out":false,"total":67680,"updated":67680,"deleted":0,"batches":68,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
Spec: https://g0v.hackmd.io/aJqHn8f5QGuBDLSMH_EinA
Schema
https://github.com/cofacts/rumors-db/pull/56
Article
addattachmentUrl
,attachmentHash
,articleType
(ArticleTypeEnum
)Method
CreateMediaArticle
(Only supports image currently.)
mediaUrl
and anarticleType
to create an article.CreateArticle
TEXT
,attachmentHash
: '',attachmentUrl
: ''ListArticles
TEXT
type articlesmediaUrl
filter to get the article whichattachmentHash
is similar to mediaUrl'sarticleTypes
filter to get certain types of articlesSetup
Cloud storage
GCS_BUCKET_NAME
, you can create a folderGCS_IMAGE_FOLDER
to save image files or leave it null to root.GCS_CREDENTIALS
. https://cloud.google.com/docs/authentication/getting-started#cloud-consoleMigration
Add a
articleType
="TEXT" to those articles which don't have aarticleType
.CreateMediaArticle curl :
graphql: