🐛 (schedules) fix creating schedules with the same name (#1463)

Closes #1375
This commit is contained in:
Matiss Janis Aboltins
2023-08-05 12:40:17 +01:00
committed by GitHub
parent 9d27379b25
commit 92099dc763
3 changed files with 15 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
BEGIN TRANSACTION;
ALTER TABLE schedules_next_date ADD COLUMN tombstone INTEGER DEFAULT 0;
COMMIT;

View File

@@ -188,9 +188,10 @@ export async function setNextDate({
// Methods
async function checkIfScheduleExists(name, scheduleId) {
let idForName = await db.first('SELECT id from schedules WHERE name = ?', [
name,
]);
let idForName = await db.first(
'SELECT id from schedules WHERE tombstone = 0 AND name = ?',
[name],
);
if (idForName == null) {
return false;

View File

@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [MatissJanis]
---
Fix creating a new schedule with the same name as a deleted schedule