AlexanderWillner/things.sh

(Things v 3.17.4) DB Location changed, Error in prepare

Closed this issue · 7 comments

Hi,
the new release of Things breaks the script in 2 ways:

1 DB location changed

Old: "/Library/Group Containers/JLMPQHK86H.com.culturedcode.ThingsMac/Things Database.thingsdatabase/main.sqli"

New: "/Library/Group Containers/JLMPQHK86H.com.culturedcode.ThingsMac/**ThingsData-XXXXX**/Things Database.thingsdatabase/main.sqli"

2 DB structure seemingly changed, i get the following error:

Error: in prepare, no such column:
TASK.dueDate
SELECT date(TASK.dueDate,"unixepoc..

Hi, the new release of Things breaks the script in 2 ways:

1 DB location changed

Old: "/Library/Group Containers/JLMPQHK86H.com.culturedcode.ThingsMac/Things Database.thingsdatabase/main.sqli"

New: "/Library/Group Containers/JLMPQHK86H.com.culturedcode.ThingsMac/**ThingsData-XXXXX**/Things Database.thingsdatabase/main.sqli"

2 DB structure seemingly changed, i get the following error:

Error: in prepare, no such column:
TASK.dueDate
SELECT date(TASK.dueDate,"unixepoc..

I was able to get things back up and running for my scripts by remapping the column names manually in the SQLites scripts I was using. For example on the CSV export; dueDate -> deadline & recurrenceRule -> rt1_recurrenceRule & actionGroup -> heading. With a little critical thinking you can figure out what they are remapped to if you inspect the database. Looks like they are prepping for a bigger upgrade down the line.

A bandaid for those to get stuff back up and running quickly right now though.

Thanks for the quick answer!
Maybe i am missing something, but i can not specify column names, i am using the ical option to write an ics file:
things.sh ical > deadlines.ical

Thanks for the quick answer! Maybe i am missing something, but i can not specify column names, i am using the ical option to write an ics file: things.sh ical > deadlines.ical

modify /bin/plugins/ical.sh

TASK.dueDate becomes TASK.deadline, TASK.actionGroup becomes TASK.heading etc...

getIcalQuery() { read -rd '' query <<-SQL || true SELECT date(TASK.dueDate,"unixepoch"), "" || TASK.title, "things:///show?id=" || TASK.uuid, "" || REPLACE(REPLACE(TASK.notes, CHAR(13), ', '), CHAR(10), ', ') FROM $TASKTABLE as TASK LEFT OUTER JOIN $TASKTABLE PROJECT ON TASK.project = PROJECT.uuid LEFT OUTER JOIN $AREATABLE AREA ON TASK.area = AREA.uuid LEFT OUTER JOIN $TASKTABLE HEADING ON TASK.actionGroup = HEADING.uuid WHERE TASK.$ISNOTTRASHED AND TASK.$ISOPEN AND TASK.dueDate NOT NULL ORDER BY TASK.dueDate LIMIT $LIMIT_BY SQL echo "$query" }

These issues should be fixed in our fork. https://github.com/amazingmarvin/things.sh

Thanks - just pushed the changes.
@mltucker I cherry-picked some changes and changed some missing parts. Your release changes look interesting...

@AlexanderWillner cool, glad you could use some code. I would have made a PR but you’ve already ported to python so I didn’t want to bother you. The release thing is there so that non-technical users can just double click.

Released.