CREATE TABLE `notes` (
	`id` varchar(32) NOT NULL,
	`content` text NOT NULL,
	`passwordHash` varchar(255),
	`isProtected` enum('true','false') NOT NULL DEFAULT 'false',
	`createdAt` timestamp NOT NULL DEFAULT (now()),
	`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
	`lastAccessedAt` timestamp NOT NULL DEFAULT (now()),
	CONSTRAINT `notes_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `shareTokens` (
	`id` int AUTO_INCREMENT NOT NULL,
	`noteId` varchar(32) NOT NULL,
	`token` varchar(64) NOT NULL,
	`type` enum('view','edit') NOT NULL,
	`createdAt` timestamp NOT NULL DEFAULT (now()),
	CONSTRAINT `shareTokens_id` PRIMARY KEY(`id`),
	CONSTRAINT `shareTokens_token_unique` UNIQUE(`token`)
);
