diff --git a/.sqlx/query-936e869631f569f2215b9fcc84dfdd188b7918f805c27970983623155aa781aa.json b/.sqlx/query-bb2fa030f2e7c7afdb38c5c54cb31de5293be332d86cf643977d479999542553.json similarity index 81% rename from .sqlx/query-936e869631f569f2215b9fcc84dfdd188b7918f805c27970983623155aa781aa.json rename to .sqlx/query-bb2fa030f2e7c7afdb38c5c54cb31de5293be332d86cf643977d479999542553.json index 1e56786..fbf8a62 100644 --- a/.sqlx/query-936e869631f569f2215b9fcc84dfdd188b7918f805c27970983623155aa781aa.json +++ b/.sqlx/query-bb2fa030f2e7c7afdb38c5c54cb31de5293be332d86cf643977d479999542553.json @@ -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" } diff --git a/.sqlx/query-751fbac9c965451b8a43ad51986cfc710ca757573ffdb90160a04041de28ae28.json b/.sqlx/query-cedfb82b38fdd0c7681b9873b1008abee4a2f4ca16abad1b837f256d0bf416b1.json similarity index 82% rename from .sqlx/query-751fbac9c965451b8a43ad51986cfc710ca757573ffdb90160a04041de28ae28.json rename to .sqlx/query-cedfb82b38fdd0c7681b9873b1008abee4a2f4ca16abad1b837f256d0bf416b1.json index 691a375..c29ec12 100644 --- a/.sqlx/query-751fbac9c965451b8a43ad51986cfc710ca757573ffdb90160a04041de28ae28.json +++ b/.sqlx/query-cedfb82b38fdd0c7681b9873b1008abee4a2f4ca16abad1b837f256d0bf416b1.json @@ -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" } diff --git a/crates/store_sqlite/migrations/20250725225640_drop_calendar_timezone.down.sql b/crates/store_sqlite/migrations/20250725225640_drop_calendar_timezone.down.sql new file mode 100644 index 0000000..25f9499 --- /dev/null +++ b/crates/store_sqlite/migrations/20250725225640_drop_calendar_timezone.down.sql @@ -0,0 +1 @@ +ALTER TABLE calendars ADD COLUMN timezone TEXT; diff --git a/crates/store_sqlite/migrations/20250725225640_drop_calendar_timezone.up.sql b/crates/store_sqlite/migrations/20250725225640_drop_calendar_timezone.up.sql new file mode 100644 index 0000000..6dae4b4 --- /dev/null +++ b/crates/store_sqlite/migrations/20250725225640_drop_calendar_timezone.up.sql @@ -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; diff --git a/crates/store_sqlite/src/calendar_store.rs b/crates/store_sqlite/src/calendar_store.rs index 4f70f1f..cfe82bf 100644 --- a/crates/store_sqlite/src/calendar_store.rs +++ b/crates/store_sqlite/src/calendar_store.rs @@ -98,7 +98,7 @@ impl SqliteCalendarStore { ) -> Result { 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, 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