Лабораторная 7: безопасность, mTLS и OpenBao, оценка 3

This commit is contained in:
Nurlygayanova Ekaterina
2026-11-13 12:41:35 +03:00
parent 20afc2c790
commit 4408471ed5
217 changed files with 21288 additions and 106 deletions
+24
View File
@@ -0,0 +1,24 @@
-- +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;