Commit 42644652ae6f40aad0256e239e2026c88e5d5616

really, totally, hopefully, fixed adding a label
timApp/schematimber.sql
(1 / 1)
  
3333 content TEXT,
3434
3535 CONSTRAINT VelpLabel_PK
36 PRIMARY KEY (id)
36 PRIMARY KEY (id, language_id)
3737);
3838
3939
timApp/timdb/velps.py
(6 / 2)
  
136136 :param content: Label content
137137 :return: id of the new label
138138 """
139
140 #coalesce so that the first insert doesn't fail.
139141 cursor = self.db.cursor()
140142 cursor.execute("""
141143 INSERT INTO
142 VelpLabel(language_id, content)
143 VALUES (?, ?)
144 VelpLabel(language_id, content, id)
145 VALUES (?, ?, (SELECT
146 coalesce(MAX(VelpLabel.id)+1,1)
147 FROM VelpLabel))
144148 """, [language_id, content]
145149 )
146150 self.db.commit()