-
-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pq: column "adv_account_sig_key" does not exist #404
Comments
Are you using some weird postgres-ish server like cockroachdb? |
I'm using cockroachdb serverless, but in the local postgres it gives the same error |
It works fine on real postgres, cockroach won't work right now because schema migrations aren't synchronous there. |
having same problem on real postgres 15.4 |
Same trying to use cockroachdb here |
Now I extract the SQL statatements using ChatGPT from store/sqlstore/upgrade.go CREATE TABLE IF NOT EXISTS whatsmeow_version (version INTEGER);
SELECT version FROM whatsmeow_version LIMIT 1;
DELETE FROM whatsmeow_version;
INSERT INTO whatsmeow_version (version) VALUES ($1);
CREATE TABLE whatsmeow_device (
jid TEXT PRIMARY KEY,
registration_id BIGINT NOT NULL CHECK (registration_id >= 0 AND registration_id < 4294967296),
noise_key bytea NOT NULL CHECK (length(noise_key) = 32),
identity_key bytea NOT NULL CHECK (length(identity_key) = 32),
signed_pre_key bytea NOT NULL CHECK (length(signed_pre_key) = 32),
signed_pre_key_id INTEGER NOT NULL CHECK (signed_pre_key_id >= 0 AND signed_pre_key_id < 16777216),
signed_pre_key_sig bytea NOT NULL CHECK (length(signed_pre_key_sig) = 64),
adv_key bytea NOT NULL,
adv_details bytea NOT NULL,
adv_account_sig bytea NOT NULL CHECK (length(adv_account_sig) = 64),
adv_device_sig bytea NOT NULL CHECK (length(adv_device_sig) = 64),
platform TEXT NOT NULL DEFAULT '',
business_name TEXT NOT NULL DEFAULT '',
push_name TEXT NOT NULL DEFAULT ''
);
CREATE TABLE whatsmeow_identity_keys (
our_jid TEXT,
their_id TEXT,
identity bytea NOT NULL CHECK (length(identity) = 32),
PRIMARY KEY (our_jid, their_id),
FOREIGN KEY (our_jid) REFERENCES whatsmeow_device(jid) ON DELETE CASCADE ON UPDATE CASCADE
);
-- Other CREATE TABLE statements similar to the ones above.
ALTER TABLE whatsmeow_device ADD COLUMN adv_account_sig_key bytea CHECK (length(adv_account_sig_key) = 32);
UPDATE whatsmeow_device SET adv_account_sig_key = (
SELECT identity FROM whatsmeow_identity_keys
WHERE our_jid = whatsmeow_device.jid AND their_id = concat(split_part(whatsmeow_device.jid, '.', 1), ':0')
);
-- Other SQL statements for PostgreSQL or SQLite specific updates.
CREATE TABLE whatsmeow_message_secrets (
our_jid TEXT,
chat_jid TEXT,
sender_jid TEXT,
message_id TEXT,
key bytea NOT NULL,
PRIMARY KEY (our_jid, chat_jid, sender_jid, message_id),
FOREIGN KEY (our_jid) REFERENCES whatsmeow_device(jid) ON DELETE CASCADE ON UPDATE CASCADE
); Apparantly cockroachdb doesn't runs update and delete on databases |
I'm using _ "github.com/lib/pq" but when I run display a error
The text was updated successfully, but these errors were encountered: