add fixup_1.sql, which corrects the UNIQUE error on user_contacts
- The user_contacts table contained an incorrect UNIQUE constraint on wa_jid that meant only one user of the bridge could have any given whatsapp user in their contacts. - This is fixed in fixup_1.sql, which should be applied over schema.sql.
This commit is contained in:
parent
f951fab325
commit
1e59c2a6c7
18
fixup_1.sql
Normal file
18
fixup_1.sql
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
BEGIN;
|
||||||
|
CREATE TABLE new_user_contacts (
|
||||||
|
id INTEGER PRIMARY KEY,
|
||||||
|
user_id INT NOT NULL REFERENCES users,
|
||||||
|
wa_jid VARCHAR NOT NULL,
|
||||||
|
subscription_state VARCHAR NOT NULL DEFAULT 'none',
|
||||||
|
avatar_url VARCHAR,
|
||||||
|
name VARCHAR,
|
||||||
|
notify VARCHAR,
|
||||||
|
status VARCHAR,
|
||||||
|
UNIQUE(user_id, wa_jid)
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO new_user_contacts SELECT * FROM user_contacts;
|
||||||
|
DROP TABLE user_contacts;
|
||||||
|
ALTER TABLE new_user_contacts RENAME TO user_contacts;
|
||||||
|
CREATE INDEX user_contacts_idx ON user_contacts (user_id, wa_jid);
|
||||||
|
COMMIT;
|
Loading…
Reference in a new issue