CREATE TABLE `note_layouts` (
	`id` varchar(36) NOT NULL,
	`note_id` varchar(36) NOT NULL,
	`user_id` varchar(36) NOT NULL,
	`column` int NOT NULL DEFAULT 1,
	`position_y` int NOT NULL DEFAULT 0,
	`height` int NOT NULL DEFAULT 220,
	`created_at` timestamp NOT NULL DEFAULT (now()),
	`updated_at` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
	CONSTRAINT `note_layouts_id` PRIMARY KEY(`id`),
	CONSTRAINT `unique_note_user_idx` UNIQUE(`note_id`,`user_id`)
);
--> statement-breakpoint
ALTER TABLE `notes` ADD `user_id` varchar(36) NOT NULL;--> statement-breakpoint
ALTER TABLE `notes` ADD `space_id` varchar(36) NOT NULL;--> statement-breakpoint
ALTER TABLE `note_layouts` ADD CONSTRAINT `note_layouts_note_id_notes_id_fk` FOREIGN KEY (`note_id`) REFERENCES `notes`(`id`) ON DELETE cascade ON UPDATE no action;