Пример #1
0
        ("ALARM_DELAY_CMD", '''kdialog --sorry "task {TITLE} ({ID}) is due for {DATE}" --title "Yokadi Daemon"''', False,
                             "Command executed by Yokadi Daemon when a tasks due date is reached soon (see ALARM_DELAY"),
        ("ALARM_DUE_CMD"  , '''kdialog --error "task {TITLE} ({ID}) should be done now" --title "Yokadi Daemon"''', False,
                             "Command executed by Yokadi Daemon when a tasks due date is reached soon (see ALARM_DELAY")
        ]
    for name, value, system, desc in rows:
        system = 1 if system else 0
        cursor.execute("insert into config(name, value, system, \"desc\")\n"
            "values (?, ?, ?, ?)", (name, value, system, desc))


def addProjectActiveColumn(cursor):
    cursor.execute("alter table project add column active boolean")
    cursor.execute("update project set active = 1")


def addTableDueDateColumn(cursor):
    cursor.execute("alter table task add column due_date datetime")


def update(cursor):
    createConfigTable(cursor)
    addProjectActiveColumn(cursor)
    addTableDueDateColumn(cursor)


if __name__ == "__main__":
    import updateutils
    updateutils.main(update)
# vi: ts=4 sw=4 et
Пример #2
0
    cursor.execute("""
create table task_lock (
    id integer not null,
    task_id integer,
    pid integer,
    update_date datetime,
    primary key (id),
    unique (task_id),
    foreign key(task_id) references task (id)
)
""")


def removeTaskTitleUniqConstraint(cursor):
    try:
        cursor.execute("drop index task_uniqTaskTitlePerProject")
    except OperationalError as exc:
        if str(exc) == "no such index: task_uniqTaskTitlePerProject":
            pass


def update(cursor):
    removeTaskTitleUniqConstraint(cursor)
    createTaskLockTable(cursor)


if __name__ == "__main__":
    import updateutils
    updateutils.main(update)
# vi: ts=4 sw=4 et