ALTER TABLE notes ADD COLUMN protected BOOLEAN NOT NULL DEFAULT FALSE;
CREATE TABLE note_files (
 id BIGINT AUTO_INCREMENT PRIMARY KEY, note_id BIGINT NOT NULL, filename TEXT NOT NULL, url VARCHAR(512) NOT NULL UNIQUE,
 mime_type VARCHAR(255) NOT NULL, size_bytes BIGINT NOT NULL, created_at VARCHAR(64) NOT NULL DEFAULT (CURRENT_TIMESTAMP),
 is_attached BOOLEAN NOT NULL DEFAULT TRUE, detached_at VARCHAR(64),
 CONSTRAINT fk_note_files_note FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE,
 INDEX idx_note_files_note (note_id, id DESC)
) ENGINE=InnoDB;
