Files
Termix/plugins/file-manager/migrations/mysql/0001_adopt_file_manager_tables.sql
T

50 lines
2.1 KiB
SQL

-- file-manager 0001: adopt_file_manager_tables
-- Generated by termix-plugin migrations. Review before committing.
CREATE TABLE IF NOT EXISTS `file_manager_recent` (
`id` int AUTO_INCREMENT PRIMARY KEY,
`user_id` varchar(255) NOT NULL,
`host_id` int NOT NULL,
`name` text NOT NULL,
`path` text NOT NULL,
`last_opened` text NOT NULL DEFAULT (CURRENT_TIMESTAMP),
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
FOREIGN KEY (`host_id`) REFERENCES `ssh_data` (`id`) ON DELETE CASCADE
);
RENAME TABLE `file_manager_recent` TO `p_file_manager_recent`;
CREATE TABLE IF NOT EXISTS `file_manager_pinned` (
`id` int AUTO_INCREMENT PRIMARY KEY,
`user_id` varchar(255) NOT NULL,
`host_id` int NOT NULL,
`name` text NOT NULL,
`path` text NOT NULL,
`pinned_at` text NOT NULL DEFAULT (CURRENT_TIMESTAMP),
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
FOREIGN KEY (`host_id`) REFERENCES `ssh_data` (`id`) ON DELETE CASCADE
);
RENAME TABLE `file_manager_pinned` TO `p_file_manager_pinned`;
CREATE TABLE IF NOT EXISTS `file_manager_shortcuts` (
`id` int AUTO_INCREMENT PRIMARY KEY,
`user_id` varchar(255) NOT NULL,
`host_id` int NOT NULL,
`name` text NOT NULL,
`path` text NOT NULL,
`created_at` text NOT NULL DEFAULT (CURRENT_TIMESTAMP),
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
FOREIGN KEY (`host_id`) REFERENCES `ssh_data` (`id`) ON DELETE CASCADE
);
RENAME TABLE `file_manager_shortcuts` TO `p_file_manager_shortcuts`;
CREATE TABLE IF NOT EXISTS `transfer_recent` (
`id` int AUTO_INCREMENT PRIMARY KEY,
`user_id` varchar(255) NOT NULL,
`source_host_id` int NOT NULL,
`dest_host_id` int NOT NULL,
`dest_path` text NOT NULL,
`dest_path_label` text NOT NULL,
`last_used` text NOT NULL DEFAULT (CURRENT_TIMESTAMP),
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
FOREIGN KEY (`source_host_id`) REFERENCES `ssh_data` (`id`) ON DELETE CASCADE,
FOREIGN KEY (`dest_host_id`) REFERENCES `ssh_data` (`id`) ON DELETE CASCADE
);
RENAME TABLE `transfer_recent` TO `p_file_manager_transfer_recent`;