Remove any remaining blank tags and enforce on DB level
This commit is contained in:
parent
6539cace59
commit
0fe5389858
3 changed files with 25 additions and 2 deletions
|
@ -2487,6 +2487,11 @@ Zotero.Schema = new function(){
|
|||
Zotero.DB.query("UPDATE itemNotes SET sourceItemID=NULL WHERE sourceItemID IN (SELECT itemID FROM items WHERE itemTypeID IN (1,14))");
|
||||
}
|
||||
|
||||
if (i==66) {
|
||||
Zotero.DB.query("DELETE FROM itemTags WHERE tagID IN (SELECT tagID FROM tags WHERE TRIM(name)='')");
|
||||
Zotero.DB.query("DELETE FROM tags WHERE TRIM(name)=''");
|
||||
}
|
||||
|
||||
Zotero.wait();
|
||||
}
|
||||
|
||||
|
|
20
triggers.sql
20
triggers.sql
|
@ -1,4 +1,4 @@
|
|||
-- 14
|
||||
-- 15
|
||||
|
||||
-- Triggers to validate date field
|
||||
DROP TRIGGER IF EXISTS insert_date_field;
|
||||
|
@ -1388,3 +1388,21 @@ CREATE TRIGGER fku_proxies_proxyID_proxyHosts_proxyID
|
|||
SELECT RAISE(ABORT, 'update on table "proxies" violates foreign key constraint "fku_proxies_proxyID_proxyHosts_proxyID"')
|
||||
WHERE (SELECT COUNT(*) FROM proxyHosts WHERE proxyID = OLD.proxyID) > 0;
|
||||
END;
|
||||
|
||||
-- Make sure tags aren't empty
|
||||
DROP TRIGGER IF EXISTS fki_tags;
|
||||
CREATE TRIGGER fki_tags
|
||||
BEFORE INSERT ON tags
|
||||
FOR EACH ROW BEGIN
|
||||
SELECT RAISE(ABORT, 'Tag cannot be blank')
|
||||
WHERE TRIM(NEW.name)='';
|
||||
END;
|
||||
|
||||
DROP TRIGGER IF EXISTS fku_tags;
|
||||
CREATE TRIGGER fku_tags
|
||||
BEFORE UPDATE OF name ON tags
|
||||
FOR EACH ROW BEGIN
|
||||
SELECT RAISE(ABORT, 'Tag cannot be blank')
|
||||
WHERE TRIM(NEW.name)='';
|
||||
END;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
-- 65
|
||||
-- 66
|
||||
|
||||
-- This file creates tables containing user-specific data for new users --
|
||||
-- any changes made here must be mirrored in transition steps in schema.js::_migrateSchema()
|
||||
|
|
Loading…
Reference in a new issue