mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 22:25:24 +00:00
22 lines
791 B
SQL
22 lines
791 B
SQL
-- opkssh 0001: adopt_opkssh_tokens
|
|
-- Generated by termix-plugin migrations. Review before committing.
|
|
|
|
CREATE TABLE IF NOT EXISTS "opkssh_tokens" (
|
|
"id" integer PRIMARY KEY AUTOINCREMENT,
|
|
"user_id" text NOT NULL,
|
|
"host_id" integer NOT NULL,
|
|
"ssh_cert" text NOT NULL,
|
|
"private_key" text NOT NULL,
|
|
"email" text,
|
|
"sub" text,
|
|
"issuer" text,
|
|
"audience" text,
|
|
"created_at" text NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"expires_at" text NOT NULL,
|
|
"last_used" text,
|
|
FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE,
|
|
FOREIGN KEY ("host_id") REFERENCES "ssh_data" ("id") ON DELETE CASCADE
|
|
);
|
|
CREATE UNIQUE INDEX IF NOT EXISTS "idx_opkssh_tokens_user_host" ON "opkssh_tokens" ("user_id", "host_id");
|
|
ALTER TABLE "opkssh_tokens" RENAME TO "p_opkssh_tokens";
|