Files
Termix/plugins/ssh-terminal/migrations/postgres/0001_adopt_command_history.sql
T

15 lines
661 B
SQL

-- ssh-terminal 0001: adopt_command_history
-- Generated by termix-plugin migrations. Review before committing.
CREATE TABLE IF NOT EXISTS "command_history" (
"id" serial PRIMARY KEY,
"user_id" varchar(255) NOT NULL,
"host_id" integer NOT NULL,
"command" text NOT NULL,
"executed_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_command_history_user_host" ON "command_history" ("user_id", "host_id");
ALTER TABLE "command_history" RENAME TO "p_ssh_terminal_command_history";