Implement proper DB migrations using Goose. Upgrade go packages.
This commit is contained in:
parent
6902facab6
commit
444e5065a4
12 changed files with 255 additions and 117 deletions
26
migrations/00007_events.sql
Normal file
26
migrations/00007_events.sql
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue