Make the recurrence range columns in the database tz-aware

This commit is contained in:
Jamie McClymont 2018-12-31 15:25:14 +13:00
parent 5fc3875345
commit 0c006b5c7c
3 changed files with 27 additions and 4 deletions

View File

@ -167,8 +167,8 @@ CREATE TABLE calendar_item (
completed TIMESTAMP WITH TIME ZONE,
dav_id INT8 UNIQUE,
collection_id INT8 REFERENCES collection(collection_id) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE,
first_instance_start TIMESTAMP WITHOUT TIME ZONE DEFAULT NULL,
last_instance_end TIMESTAMP WITHOUT TIME ZONE DEFAULT NULL,
first_instance_start TIMESTAMP WITH TIME ZONE DEFAULT NULL,
last_instance_end TIMESTAMP WITH TIME ZONE DEFAULT NULL,
-- Cascade updates / deletes from the caldav_data table
CONSTRAINT caldav_exists FOREIGN KEY ( user_no, dav_name )
@ -489,4 +489,4 @@ CREATE SEQUENCE metrics_count_delticket;
CREATE SEQUENCE metrics_count_bind;
CREATE SEQUENCE metrics_count_unknown;
SELECT new_db_revision(1,3,2, 'Luty' );
SELECT new_db_revision(1,3,3, 'Marzec' );

23
dba/patches/1.3.3.sql Normal file
View File

@ -0,0 +1,23 @@
-- Notable enhancement: change first_instance_start and last_instance_end to be timezone-aware
BEGIN;
SELECT check_db_revision(1,3,2);
ALTER TABLE calendar_item
ALTER COLUMN first_instance_start
TYPE TIMESTAMP WITH TIME ZONE
-- I don't believe the column has ever been populated, but if it has, we want
-- to throw away that data anyway because we don't know its timezone
USING NULL::timestamptz;
ALTER TABLE calendar_item
ALTER COLUMN last_instance_end
TYPE TIMESTAMP WITH TIME ZONE
USING NULL::timestamptz; -- As above
-- http://blogs.transparent.com/polish/names-of-the-months-and-their-meaning/
SELECT new_db_revision(1,3,3, 'Marzec' );
COMMIT;
ROLLBACK;

View File

@ -1,4 +1,4 @@
The database is version XX currently at revision 1.3.2.
The database is version XX currently at revision 1.3.3.
No patches were applied.
Supported locales updated.
Updated view: dav_principal.sql applied.