This file contains instructions for upgrading the contact database.
su - postgres
psql \
-f /usr/share/doc/intelmq-certbund-contact/sql/update-0.9.4.sql \
contactdb
Thereafter the access rights must be adjusted like:
GRANT SELECT ON ALL TABLES IN SCHEMA public TO intelmq;
GRANT SELECT, INSERT, UPDATE, DELETE
ON ALL TABLES IN SCHEMA public TO contacts;
DROP FUNCTION email_annotations(VARCHAR(100));
DROP VIEW email_annotation;
DROP TABLE email_tag;
DROP TABLE tag;
DROP TABLE tag_name;
The Version 0.9.3 of intelmq-certbund-contact relies on features of PostgreSQL 9.4 to accelerate operations on inet addresses. Therefor an additional index must be created in the database, this is done by the provided update script:
su - postgres
psql \
-f /usr/share/doc/intelmq-certbund-contact/sql/update-0.9.3.sql \
contactdb
The instructions below only apply to database that were created before the code was maintained in the intelmq-certbund-contact repository.
CREATE TABLE email_status (
email VARCHAR(100) PRIMARY KEY,
enabled BOOLEAN NOT NULL,
added TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP
);
-- Make sure the user used by the contact bot can access the table.
-- Adapt the username if necessary.
GRANT SELECT ON ALL TABLES IN SCHEMA public TO intelmq;
DROP TABLE email_status;
CREATE INDEX organisation_to_asn_asn_idx
ON organisation_to_asn (asn);
CREATE INDEX organisation_to_asn_automatic_asn_idx
ON organisation_to_asn_automatic (asn);
DROP INDEX organisation_to_asn_asn_idx;
DROP INDEX organisation_to_asn_automatic_asn_idx;
This index was implicitly removed by the removal of the UNIQUE constraint on fqdn (fqdn). The analogous index on network (address) is not needed currently and therefore it's not a problem that it was removed together the UNIQUE constraint.
CREATE INDEX fqdn_fqdn_idx ON fqdn (fqdn);
DROP INDEX fqdn_fqdn_idx;
ALTER TABLE fqdn DROP CONSTRAINT fqdn_fqdn_key;
ALTER TABLE network DROP CONSTRAINT network_address_key;
ALTER TABLE fqdn ADD CONSTRAINT fqdn_fqdn_key UNIQUE (fqdn);
ALTER TABLE network ADD CONSTRAINT network_address_key UNIQUE (address);
Intevation/intelmq/issues/17 (certbund-contact: renaming pgp_key_id)
-- you may need to close other connections/cursors to the db before
ALTER TABLE contact RENAME COLUMN pgp_key_id TO openpgp_fpr;
ALTER TABLE contact_automatic RENAME COLUMN pgp_key_id TO openpgp_fpr;
-- you may need to close other connections/cursors to the db before
ALTER TABLE contact RENAME COLUMN openpgp_fpr TO pgp_key_id;
ALTER TABLE contact_automatic RENAME COLUMN openpgp_fpr TO pgp_key_id;