ALTER TABLE listmembers DROP FOREIGN KEY listmembers_ibfk_1;
COMMIT;
ALTER TABLE listmembers DROP FOREIGN KEY listmembers_ibfk_2;
COMMIT;
ALTER TABLE listmembers CHANGE person_id uid VARCHAR(16) NOT NULL;
COMMIT;
CREATE INDEX ix_listmembers_list_id ON listmembers (list_id);
COMMIT;
ALTER TABLE listmembers ADD CONSTRAINT listmembers_fk1 FOREIGN KEY(uid) REFERENCES people (id) ON DELETE CASCADE;
COMMIT;
ALTER TABLE listmembers ADD CONSTRAINT listmembers_fk2 FOREIGN KEY(list_id) REFERENCES lists (id) ON DELETE CASCADE;
COMMIT;
ALTER TABLE albums ADD COLUMN list_id VARCHAR(16);
COMMIT;
ALTER TABLE albums ADD CONSTRAINT albums_fk1 FOREIGN KEY(list_id) REFERENCES lists (id);
COMMIT;
ALTER TABLE contacts ADD COLUMN muted BOOL NOT NULL DEFAULT 0;
COMMIT;
ALTER TABLE contacts ADD CHECK (muted IN (0, 1));
COMMIT;
ALTER TABLE contacts DROP FOREIGN KEY contacts_ibfk_1;
