mirror of
https://github.com/Sosokker/go-chi-oapi-codegen-todolist.git
synced 2025-12-19 05:54:07 +01:00
14 lines
737 B
SQL
14 lines
737 B
SQL
-- backend/migrations/000002_add_single_attachment_url.up.sql
|
|
ALTER TABLE todos
|
|
ADD COLUMN attachment_url TEXT NULL;
|
|
|
|
-- Optional: Add a comment for clarity
|
|
COMMENT ON COLUMN todos.attachment_url IS 'Publicly accessible URL for the single image attachment';
|
|
|
|
-- Drop the old attachments array column and the separate attachments table
|
|
ALTER TABLE todos DROP COLUMN IF EXISTS attachments;
|
|
DROP TABLE IF EXISTS attachments; -- Cascade should handle FKs if any existed, but we assume it's clean
|
|
|
|
-- NOTE: No data migration from TEXT[] to TEXT is included here for simplicity.
|
|
-- In a real scenario, you might add logic here to migrate the first element
|
|
-- of the old array if it represented a URL, but that depends heavily on previous data. |