Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions migrations/041-add-tag-column-type.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
let db = require('../src/db').sequelize;

module.exports = {
up: function() {
try {
return db.query(`
ALTER TABLE tags ADD type VARCHAR(30) NULL DEFAULT NULL AFTER name;`);
} catch(e) {
return true;
}
}, down: function() {
try {
return db.query(`
ALTER TABLE tags DROP IF EXISTS type;`);
} catch(e) {
return true;
}
}
}
8 changes: 8 additions & 0 deletions src/models/Tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ module.exports = function( db, sequelize, DataTypes ) {
}
},

type: {
type : DataTypes.STRING,
allowNull : true,
set : function( text ) {
this.setDataValue('type', sanitize.safeTags(text.trim()));
}
},

extraData: getExtraDataConfig(DataTypes.JSON, 'tags')
}, {

Expand Down