Skip to content

Commit

Permalink
audit log and annotations: remove column 'created'
Browse files Browse the repository at this point in the history
as per customer request
the 'added' entries in audit log are sufficient
  • Loading branch information
wagner-intevation committed Aug 12, 2024
1 parent 5f26a61 commit c6d9918
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
7 changes: 1 addition & 6 deletions sql/initdb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ CREATE TABLE organisation_annotation (
organisation_annotation_id SERIAL PRIMARY KEY,
organisation_id INTEGER NOT NULL,
annotation JSONB NOT NULL,
created TIMESTAMP WITH TIME ZONE DEFAULT now(),

FOREIGN KEY (organisation_id) REFERENCES organisation(organisation_id)
);
Expand Down Expand Up @@ -128,8 +127,7 @@ CREATE INDEX contact_automatic_organisation_idx
CREATE TABLE autonomous_system_annotation (
autonomous_system_annotation_id SERIAL PRIMARY KEY,
asn BIGINT NOT NULL,
annotation JSONB NOT NULL,
created TIMESTAMP WITH TIME ZONE DEFAULT now()
annotation JSONB NOT NULL
);

CREATE INDEX autonomous_system_annotation_asn_idx
Expand Down Expand Up @@ -200,7 +198,6 @@ CREATE TABLE network_annotation (
network_annotation_id SERIAL PRIMARY KEY,
network_id INTEGER NOT NULL,
annotation JSONB NOT NULL,
created TIMESTAMP WITH TIME ZONE DEFAULT now(),

FOREIGN KEY (network_id) REFERENCES network(network_id)
);
Expand Down Expand Up @@ -241,7 +238,6 @@ CREATE TABLE fqdn_annotation (
fqdn_annotation_id SERIAL PRIMARY KEY,
fqdn_id INTEGER NOT NULL,
annotation JSONB NOT NULL,
created TIMESTAMP WITH TIME ZONE DEFAULT now(),

FOREIGN KEY (fqdn_id) REFERENCES fqdn(fqdn_id)
);
Expand Down Expand Up @@ -482,7 +478,6 @@ CREATE TABLE audit_log (
time TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
"table" VARCHAR(50) NOT NULL,
"user" TEXT NOT NULL,
created TIMESTAMP WITH TIME ZONE,
operation VARCHAR(20) NOT NULL,
object_type TEXT NOT NULL,
object_value TEXT NOT NULL,
Expand Down
13 changes: 4 additions & 9 deletions sql/update-0.9.5.sql → sql/update-1.0.3.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ CREATE TABLE audit_log (
time TIMESTAMP WITH TIME ZONE DEFAULT now() NOT NULL,
"table" VARCHAR(50) NOT NULL,
"user" TEXT NOT NULL,
created TIMESTAMP WITH TIME ZONE,
operation VARCHAR(20) NOT NULL,
object_type TEXT NOT NULL,
object_value TEXT NOT NULL,
Expand All @@ -14,20 +13,16 @@ CREATE TABLE audit_log (
);

ALTER TABLE organisation_annotation
ALTER COLUMN annotation SET DATA TYPE jsonb,
ADD COLUMN created TIMESTAMP WITH TIME ZONE DEFAULT now();
ALTER COLUMN annotation SET DATA TYPE jsonb;

ALTER TABLE autonomous_system_annotation
ALTER COLUMN annotation SET DATA TYPE jsonb,
ADD COLUMN created TIMESTAMP WITH TIME ZONE DEFAULT now();
ALTER COLUMN annotation SET DATA TYPE jsonb;

ALTER TABLE network_annotation
ALTER COLUMN annotation SET DATA TYPE jsonb,
ADD COLUMN created TIMESTAMP WITH TIME ZONE DEFAULT now();
ALTER COLUMN annotation SET DATA TYPE jsonb;

ALTER TABLE fqdn_annotation
ALTER COLUMN annotation SET DATA TYPE jsonb,
ADD COLUMN created TIMESTAMP WITH TIME ZONE DEFAULT now();
ALTER COLUMN annotation SET DATA TYPE jsonb;

-- Type change from JSON to JSONB
CREATE OR REPLACE FUNCTION email_annotations(email_address VARCHAR(100))
Expand Down

0 comments on commit c6d9918

Please sign in to comment.