simonsobs / sotodlib

Simons Observatory: Time-Ordered Data processing library.
MIT License
16 stars 19 forks source link

Fix unique constraint and indent logic error #961

Closed kmharrington closed 2 months ago

kmharrington commented 2 months ago

Found while trying to close our some LAT time codes. Change the unique constraint to deal correctly with different servers.

closes #960

To update existing tables will need to run. (I'll take care of doing this on site)

CREATE TABLE time_codes_new (
        id INTEGER NOT NULL, 
        stream_id VARCHAR, 
        suprsync_type INTEGER, 
        timecode INTEGER, 
        agent VARCHAR, 
        PRIMARY KEY (id), 
        UNIQUE (stream_id, suprsync_type, timecode, agent)
);

INSERT INTO time_codes_new SELECT * from time_codes;
DROP TABLE time_codes;
ALTER TABLE time_codes_new RENAME to time_codes;