mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 14:15:24 +00:00
54 lines
2.5 KiB
SQL
54 lines
2.5 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" serial PRIMARY KEY,
|
|
"user_id" varchar(255) NOT NULL,
|
|
"host_id" integer 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
|
|
);
|
|
CREATE INDEX IF NOT EXISTS "idx_file_manager_recent_user" ON "file_manager_recent" ("user_id", "host_id");
|
|
ALTER TABLE "file_manager_recent" RENAME TO "p_file_manager_recent";
|
|
CREATE TABLE IF NOT EXISTS "file_manager_pinned" (
|
|
"id" serial PRIMARY KEY,
|
|
"user_id" varchar(255) NOT NULL,
|
|
"host_id" integer 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
|
|
);
|
|
CREATE INDEX IF NOT EXISTS "idx_file_manager_pinned_user" ON "file_manager_pinned" ("user_id", "host_id");
|
|
ALTER TABLE "file_manager_pinned" RENAME TO "p_file_manager_pinned";
|
|
CREATE TABLE IF NOT EXISTS "file_manager_shortcuts" (
|
|
"id" serial PRIMARY KEY,
|
|
"user_id" varchar(255) NOT NULL,
|
|
"host_id" integer 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
|
|
);
|
|
CREATE INDEX IF NOT EXISTS "idx_file_manager_shortcuts_user" ON "file_manager_shortcuts" ("user_id", "host_id");
|
|
ALTER TABLE "file_manager_shortcuts" RENAME TO "p_file_manager_shortcuts";
|
|
CREATE TABLE IF NOT EXISTS "transfer_recent" (
|
|
"id" serial PRIMARY KEY,
|
|
"user_id" varchar(255) NOT NULL,
|
|
"source_host_id" integer NOT NULL,
|
|
"dest_host_id" integer 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
|
|
);
|
|
CREATE INDEX IF NOT EXISTS "idx_transfer_recent_user" ON "transfer_recent" ("user_id");
|
|
ALTER TABLE "transfer_recent" RENAME TO "p_file_manager_transfer_recent";
|