-- +goose Up ALTER TABLE attachment_jobs ADD COLUMN traceparent text NOT NULL DEFAULT ''; ALTER TABLE attachment_jobs ADD COLUMN tracestate text NOT NULL DEFAULT ''; -- +goose StatementBegin CREATE OR REPLACE FUNCTION enqueue_attachment() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN IF NEW.status='queued' THEN INSERT INTO attachment_jobs(attachment_id, staging_key, traceparent, tracestate) VALUES (NEW.id, NEW.object_key, coalesce(current_setting('messenger.traceparent',true),''), coalesce(current_setting('messenger.tracestate',true),'')); END IF; RETURN NEW; END $$; -- +goose StatementEnd -- +goose Down -- +goose StatementBegin CREATE OR REPLACE FUNCTION enqueue_attachment() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN IF NEW.status='queued' THEN INSERT INTO attachment_jobs(attachment_id, staging_key) VALUES (NEW.id, NEW.object_key); END IF; RETURN NEW; END $$; -- +goose StatementEnd ALTER TABLE attachment_jobs DROP COLUMN traceparent, DROP COLUMN tracestate;