-- snippets 0001: adopt_snippets_tables -- Generated by termix-plugin migrations. Review before committing. CREATE TABLE IF NOT EXISTS `snippets` ( `id` int AUTO_INCREMENT PRIMARY KEY, `user_id` varchar(255) NOT NULL, `name` text NOT NULL, `content` text NOT NULL, `description` text, `folder` text, `order` int NOT NULL DEFAULT 0, `sync_id` varchar(255) UNIQUE, `created_at` text NOT NULL DEFAULT (CURRENT_TIMESTAMP), `updated_at` text NOT NULL DEFAULT (CURRENT_TIMESTAMP), `host_filter` text, `is_note` boolean NOT NULL DEFAULT false, FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ); RENAME TABLE `snippets` TO `p_snippets_snippets`; CREATE TABLE IF NOT EXISTS `snippet_folders` ( `id` int AUTO_INCREMENT PRIMARY KEY, `user_id` varchar(255) NOT NULL, `name` text NOT NULL, `color` text, `icon` text, `sync_id` varchar(255) UNIQUE, `created_at` text NOT NULL DEFAULT (CURRENT_TIMESTAMP), `updated_at` text NOT NULL DEFAULT (CURRENT_TIMESTAMP), FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ); RENAME TABLE `snippet_folders` TO `p_snippets_snippet_folders`; CREATE TABLE IF NOT EXISTS `snippet_access` ( `id` int AUTO_INCREMENT PRIMARY KEY, `snippet_id` int NOT NULL, `user_id` varchar(255), `role_id` int, `granted_by` varchar(255) NOT NULL, `permission_level` text NOT NULL DEFAULT ('view'), `expires_at` text, `created_at` text NOT NULL DEFAULT (CURRENT_TIMESTAMP), FOREIGN KEY (`granted_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ); RENAME TABLE `snippet_access` TO `p_snippets_snippet_access`;