| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- const DatabaseModel = require("./DatabaseModel.js").DatabaseModel;
- function MediaFileTagModel(md5sum, tag, fromMeta, fromAutotag) {
- DatabaseModel.call(this);
- this.md5sum = md5sum || "";
- this.tag = tag || "";
- this.fromMeta = fromMeta;
- this.fromAutotag = !!fromAutotag;
- }
- MediaFileTagModel.prototype = Object.create(DatabaseModel.prototype);
- MediaFileTagModel.prototype.getTableName = function() {
- return "mediaTag";
- }
- MediaFileTagModel.prototype.createOrUpdateBase = async function(dbHelper) {
- await dbHelper.runSql(`CREATE TABLE IF NOT EXISTS 'mediaTag' (
- md5sum STRING NOT NULL,
- tag varchar(32) NOT NULL,
- fromMeta BOOLEAN NOT NULL,
- fromAutotag BOOLEAN NOT NULL,
- PRIMARY KEY (md5sum, tag))`);
- }
- MediaFileTagModel.prototype.describe = function() {
- return {
- "md5sum": this.md5sum,
- "tag": this.tag,
- "fromMeta": this.fromMeta,
- "fromAutotag": this.fromAutotag
- };
- }
- MediaFileTagModel.prototype.versionColumn = function() { return ""; }
- MediaFileTagModel.prototype.fromDb = function(dbObj) {
- this.md5sum = dbObj["md5sum"];
- this.tag = dbObj["tag"];
- this.fromMeta = dbObj["fromMeta"];
- this.fromAutotag = dbObj["fromAutotag"];
- }
- module.exports.MediaFileTagModel = MediaFileTagModel;
|