mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-04 08:12:39 +00:00
remove migration in favor of as-edited approach
This commit is contained in:
@@ -299,7 +299,10 @@ const Editor = createClass({
|
|||||||
style={{ display: 'none' }}
|
style={{ display: 'none' }}
|
||||||
rerenderParent={this.rerenderParent} />
|
rerenderParent={this.rerenderParent} />
|
||||||
<MetadataEditor
|
<MetadataEditor
|
||||||
metadata={this.props.brew}
|
metadata={({
|
||||||
|
...this.props.brew,
|
||||||
|
tags : typeof this.props.brew.tags === 'string' ? [] : this.props.brew.tags
|
||||||
|
})}
|
||||||
onChange={this.props.onMetaChange} />
|
onChange={this.props.onMetaChange} />
|
||||||
</>;
|
</>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,7 +176,8 @@ app.get('/user/:username', async (req, res, next)=>{
|
|||||||
'editId',
|
'editId',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
'updatedAt',
|
'updatedAt',
|
||||||
'lastViewed'
|
'lastViewed',
|
||||||
|
'tags'
|
||||||
];
|
];
|
||||||
|
|
||||||
let brews = await HomebrewModel.getByUser(req.params.username, ownAccount, fields)
|
let brews = await HomebrewModel.getByUser(req.params.username, ownAccount, fields)
|
||||||
|
|||||||
@@ -124,7 +124,6 @@ const GoogleActions = {
|
|||||||
title : file.properties.title,
|
title : file.properties.title,
|
||||||
description : file.description,
|
description : file.description,
|
||||||
views : parseInt(file.properties.views),
|
views : parseInt(file.properties.views),
|
||||||
tags : '',
|
|
||||||
published : file.properties.published ? file.properties.published == 'true' : false,
|
published : file.properties.published ? file.properties.published == 'true' : false,
|
||||||
systems : [],
|
systems : [],
|
||||||
thumbnail : file.properties.thumbnail
|
thumbnail : file.properties.thumbnail
|
||||||
|
|||||||
@@ -180,7 +180,6 @@ const updateBrew = async (req, res)=>{
|
|||||||
let afterSave = async ()=>true;
|
let afterSave = async ()=>true;
|
||||||
|
|
||||||
brew.text = mergeBrewText(brew);
|
brew.text = mergeBrewText(brew);
|
||||||
brew.tags = updateBrew.tags;
|
|
||||||
|
|
||||||
if(brew.googleId && removeFromGoogle) {
|
if(brew.googleId && removeFromGoogle) {
|
||||||
// If the google id exists and we're removing it from google, set afterSave to delete the google brew and mark the brew's google id as undefined
|
// If the google id exists and we're removing it from google, set afterSave to delete the google brew and mark the brew's google id as undefined
|
||||||
|
|||||||
@@ -68,26 +68,6 @@ HomebrewSchema.statics.getByUser = function(username, allowAccess=false, fields=
|
|||||||
|
|
||||||
const Homebrew = mongoose.model('Homebrew', HomebrewSchema);
|
const Homebrew = mongoose.model('Homebrew', HomebrewSchema);
|
||||||
|
|
||||||
if(process.env.MIGRATE === 'true') {
|
|
||||||
Homebrew.count({ tags: '' }, async (err, count)=>{
|
|
||||||
if(!err) {
|
|
||||||
if(count > 0) {
|
|
||||||
Homebrew.updateMany({ tags: '' }, { tags: [] }, { multi: true }, function(err, data) {
|
|
||||||
if(!err) {
|
|
||||||
console.log('Successfully updated all brews to new schema definition');
|
|
||||||
} else {
|
|
||||||
console.log('An error occurred while updating brews to the new schema', err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.log('No brews to update');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log('An error occurred while counting brews with the old schema', err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
schema : HomebrewSchema,
|
schema : HomebrewSchema,
|
||||||
model : Homebrew,
|
model : Homebrew,
|
||||||
|
|||||||
Reference in New Issue
Block a user