Files
TODO_list_system/backend/migrations/add_public_feature.sql
beabigegg f3f2b7d596 2nd
2025-08-29 19:02:19 +08:00

19 lines
705 B
SQL

-- Add public/private feature to TodoItem table
-- Date: 2025-08-29
-- Add is_public column to todo_item table
ALTER TABLE todo_item
ADD COLUMN is_public BOOLEAN DEFAULT FALSE COMMENT '是否公開';
-- Add tags column to todo_item table (JSON type for flexible tagging)
ALTER TABLE todo_item
ADD COLUMN tags JSON DEFAULT NULL COMMENT '標籤';
-- Create index for public todos query performance
CREATE INDEX idx_is_public ON todo_item(is_public);
-- Create index for tags search (if MySQL version supports JSON index)
-- CREATE INDEX idx_tags ON todo_item((CAST(tags AS CHAR(255))));
-- Update existing todos to be private by default
UPDATE todo_item SET is_public = FALSE WHERE is_public IS NULL;