Implement proper DB migrations using Goose. Upgrade go packages.
All checks were successful
Build Docker image / build (push) Successful in 1m8s
Build Golang packages / release (push) Has been skipped

This commit is contained in:
Pieter Hollander 2024-07-26 22:35:30 +02:00
parent 6902facab6
commit 444e5065a4
Signed by: pieter
SSH key fingerprint: SHA256:HbX+9cBXsop9SuvL+mELd29sK+7DehFfdVweFVDtMSg
12 changed files with 255 additions and 117 deletions

View file

@ -0,0 +1,26 @@
-- +goose Up
-- +goose StatementBegin
DO $$
BEGIN
-- Check if start_timestamp column exists
IF NOT EXISTS (SELECT 1 FROM information_schema.columns
WHERE table_name='opendtu_events'
AND column_name='start_timestamp') THEN
-- Add start_timestamp column
ALTER TABLE opendtu_events
ADD COLUMN start_timestamp TIMESTAMPTZ;
END IF;
-- Check if end_timestamp column exists
IF NOT EXISTS (SELECT 1 FROM information_schema.columns
WHERE table_name='opendtu_events'
AND column_name='end_timestamp') THEN
-- Add end_timestamp column
ALTER TABLE opendtu_events
ADD COLUMN end_timestamp TIMESTAMPTZ;
END IF;
END $$;
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
-- +goose StatementEnd