Files
Termix/plugins/homepage/migrations/mysql/0001_adopt_homepage_tables.sql
T

37 lines
1.5 KiB
SQL

-- homepage 0001: adopt_homepage_tables
-- Generated by termix-plugin migrations. Review before committing.
CREATE TABLE IF NOT EXISTS `homepage_items` (
`id` int AUTO_INCREMENT PRIMARY KEY,
`user_id` varchar(255) NOT NULL,
`type_id` text NOT NULL,
`title` text,
`config` text NOT NULL DEFAULT ('{}'),
`folder_id` int,
`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 `homepage_items` TO `p_homepage_homepage_items`;
CREATE TABLE IF NOT EXISTS `homepage_layouts` (
`id` int AUTO_INCREMENT PRIMARY KEY,
`user_id` varchar(255) NOT NULL UNIQUE,
`layout` text NOT NULL DEFAULT ('{}'),
`updated_at` text NOT NULL DEFAULT (CURRENT_TIMESTAMP),
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
);
RENAME TABLE `homepage_layouts` TO `p_homepage_homepage_layouts`;
CREATE TABLE IF NOT EXISTS `dashboard_service_links` (
`id` int AUTO_INCREMENT PRIMARY KEY,
`user_id` varchar(255) NOT NULL,
`label` text NOT NULL,
`url` text NOT NULL,
`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),
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
);
RENAME TABLE `dashboard_service_links` TO `p_homepage_dashboard_service_links`;