sqlite_store: Drop timezone column in favour of timezone_id

This commit is contained in:
Lennart
2025-07-25 23:01:51 +02:00
parent 1ba9a97b3f
commit a22235d976
5 changed files with 36 additions and 32 deletions

View File

@@ -1,6 +1,6 @@
{
"db_name": "SQLite",
"query": "SELECT principal, id, displayname, \"order\", description, color, timezone_id, deleted_at, synctoken, subscription_url, push_topic, comp_event, comp_todo, comp_journal\n FROM calendars\n WHERE (principal, id) = (?, ?)\n AND ((deleted_at IS NULL) OR ?) ",
"query": "SELECT *\n FROM calendars\n WHERE (principal, id) = (?, ?)\n AND ((deleted_at IS NULL) OR ?) ",
"describe": {
"columns": [
{
@@ -14,14 +14,14 @@
"type_info": "Text"
},
{
"name": "displayname",
"name": "synctoken",
"ordinal": 2,
"type_info": "Text"
"type_info": "Integer"
},
{
"name": "order",
"name": "displayname",
"ordinal": 3,
"type_info": "Integer"
"type_info": "Text"
},
{
"name": "description",
@@ -29,24 +29,24 @@
"type_info": "Text"
},
{
"name": "color",
"name": "order",
"ordinal": 5,
"type_info": "Text"
"type_info": "Integer"
},
{
"name": "timezone_id",
"name": "color",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "deleted_at",
"name": "timezone_id",
"ordinal": 7,
"type_info": "Datetime"
"type_info": "Text"
},
{
"name": "synctoken",
"name": "deleted_at",
"ordinal": 8,
"type_info": "Integer"
"type_info": "Datetime"
},
{
"name": "subscription_url",
@@ -80,6 +80,8 @@
"nullable": [
false,
false,
false,
true,
true,
false,
true,
@@ -87,12 +89,10 @@
true,
true,
false,
true,
false,
false,
false,
false
]
},
"hash": "936e869631f569f2215b9fcc84dfdd188b7918f805c27970983623155aa781aa"
"hash": "bb2fa030f2e7c7afdb38c5c54cb31de5293be332d86cf643977d479999542553"
}

View File

@@ -1,6 +1,6 @@
{
"db_name": "SQLite",
"query": "SELECT principal, id, displayname, \"order\", description, color, timezone_id, deleted_at, synctoken, subscription_url, push_topic, comp_event, comp_todo, comp_journal\n FROM calendars\n WHERE principal = ? AND deleted_at IS NULL",
"query": "SELECT *\n FROM calendars\n WHERE principal = ? AND deleted_at IS NULL",
"describe": {
"columns": [
{
@@ -14,14 +14,14 @@
"type_info": "Text"
},
{
"name": "displayname",
"name": "synctoken",
"ordinal": 2,
"type_info": "Text"
"type_info": "Integer"
},
{
"name": "order",
"name": "displayname",
"ordinal": 3,
"type_info": "Integer"
"type_info": "Text"
},
{
"name": "description",
@@ -29,24 +29,24 @@
"type_info": "Text"
},
{
"name": "color",
"name": "order",
"ordinal": 5,
"type_info": "Text"
"type_info": "Integer"
},
{
"name": "timezone_id",
"name": "color",
"ordinal": 6,
"type_info": "Text"
},
{
"name": "deleted_at",
"name": "timezone_id",
"ordinal": 7,
"type_info": "Datetime"
"type_info": "Text"
},
{
"name": "synctoken",
"name": "deleted_at",
"ordinal": 8,
"type_info": "Integer"
"type_info": "Datetime"
},
{
"name": "subscription_url",
@@ -80,6 +80,8 @@
"nullable": [
false,
false,
false,
true,
true,
false,
true,
@@ -87,12 +89,10 @@
true,
true,
false,
true,
false,
false,
false,
false
]
},
"hash": "751fbac9c965451b8a43ad51986cfc710ca757573ffdb90160a04041de28ae28"
"hash": "cedfb82b38fdd0c7681b9873b1008abee4a2f4ca16abad1b837f256d0bf416b1"
}

View File

@@ -0,0 +1 @@
ALTER TABLE calendars ADD COLUMN timezone TEXT;

View File

@@ -0,0 +1,3 @@
-- We don't want to save timezones as ics anymore
-- but instead just rely on the TZDB identifier
ALTER TABLE calendars DROP COLUMN timezone;

View File

@@ -98,7 +98,7 @@ impl SqliteCalendarStore {
) -> Result<Calendar, Error> {
let cal = sqlx::query_as!(
CalendarRow,
r#"SELECT principal, id, displayname, "order", description, color, timezone_id, deleted_at, synctoken, subscription_url, push_topic, comp_event, comp_todo, comp_journal
r#"SELECT *
FROM calendars
WHERE (principal, id) = (?, ?)
AND ((deleted_at IS NULL) OR ?) "#,
@@ -118,7 +118,7 @@ impl SqliteCalendarStore {
) -> Result<Vec<Calendar>, Error> {
let cals = sqlx::query_as!(
CalendarRow,
r#"SELECT principal, id, displayname, "order", description, color, timezone_id, deleted_at, synctoken, subscription_url, push_topic, comp_event, comp_todo, comp_journal
r#"SELECT *
FROM calendars
WHERE principal = ? AND deleted_at IS NULL"#,
principal