mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-30 23:25:24 +00:00
feat: move termix identity into a plugin (C6)
This commit is contained in:
1 parent
6e56c90aac
commit
4dbce08379
157 files changed
+20743
-5766
No files matched your search
@@ -0,0 +1,46 @@
|
||||
-- termix-identity 0001: adopt_termix_identity_tables
|
||||
-- Generated by termix-plugin migrations. Review before committing.
|
||||
-- Hand-edited: keeps the legacy foreign keys the SDK cannot declare
|
||||
-- (keys and ca to their identity, keys to ssh_credentials).
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `termix_identities` (
|
||||
`id` int AUTO_INCREMENT PRIMARY KEY,
|
||||
`user_id` varchar(255) NOT NULL UNIQUE,
|
||||
`handle` varchar(255) NOT NULL UNIQUE,
|
||||
`description` text,
|
||||
`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 `termix_identities` TO `p_termix_identity_identities`;
|
||||
CREATE TABLE IF NOT EXISTS `termix_identity_keys` (
|
||||
`id` int AUTO_INCREMENT PRIMARY KEY,
|
||||
`identity_id` int NOT NULL,
|
||||
`user_id` varchar(255) NOT NULL,
|
||||
`public_key` text NOT NULL,
|
||||
`key_type` text NOT NULL,
|
||||
`algorithm` text NOT NULL,
|
||||
`label` text,
|
||||
`comment` text,
|
||||
`source` text NOT NULL DEFAULT ('manual'),
|
||||
`credential_id` int,
|
||||
`enabled` boolean NOT NULL DEFAULT true,
|
||||
`created_at` text NOT NULL DEFAULT (CURRENT_TIMESTAMP),
|
||||
FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`identity_id`) REFERENCES `p_termix_identity_identities` (`id`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`credential_id`) REFERENCES `ssh_credentials` (`id`) ON DELETE SET NULL
|
||||
);
|
||||
RENAME TABLE `termix_identity_keys` TO `p_termix_identity_keys`;
|
||||
CREATE TABLE IF NOT EXISTS `termix_identity_ca` (
|
||||
`id` int AUTO_INCREMENT PRIMARY KEY,
|
||||
`identity_id` int NOT NULL UNIQUE,
|
||||
`user_id` varchar(255) NOT NULL,
|
||||
`public_key` text NOT NULL,
|
||||
`private_key` text NOT NULL,
|
||||
`validity_days` int NOT NULL DEFAULT 90,
|
||||
`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,
|
||||
FOREIGN KEY (`identity_id`) REFERENCES `p_termix_identity_identities` (`id`) ON DELETE CASCADE
|
||||
);
|
||||
RENAME TABLE `termix_identity_ca` TO `p_termix_identity_ca`;
|
||||
@@ -0,0 +1,47 @@
|
||||
-- termix-identity 0001: adopt_termix_identity_tables
|
||||
-- Generated by termix-plugin migrations. Review before committing.
|
||||
-- Hand-edited: keeps the legacy foreign keys the SDK cannot declare
|
||||
-- (keys and ca to their identity, keys to ssh_credentials).
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "termix_identities" (
|
||||
"id" serial PRIMARY KEY,
|
||||
"user_id" varchar(255) NOT NULL UNIQUE,
|
||||
"handle" varchar(255) NOT NULL UNIQUE,
|
||||
"description" text,
|
||||
"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
|
||||
);
|
||||
ALTER TABLE "termix_identities" RENAME TO "p_termix_identity_identities";
|
||||
CREATE TABLE IF NOT EXISTS "termix_identity_keys" (
|
||||
"id" serial PRIMARY KEY,
|
||||
"identity_id" integer NOT NULL,
|
||||
"user_id" varchar(255) NOT NULL,
|
||||
"public_key" text NOT NULL,
|
||||
"key_type" text NOT NULL,
|
||||
"algorithm" text NOT NULL,
|
||||
"label" text,
|
||||
"comment" text,
|
||||
"source" text NOT NULL DEFAULT 'manual',
|
||||
"credential_id" integer,
|
||||
"enabled" boolean NOT NULL DEFAULT true,
|
||||
"created_at" text NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE,
|
||||
FOREIGN KEY ("identity_id") REFERENCES "p_termix_identity_identities" ("id") ON DELETE CASCADE,
|
||||
FOREIGN KEY ("credential_id") REFERENCES "ssh_credentials" ("id") ON DELETE SET NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS "idx_termix_identity_keys_identity" ON "termix_identity_keys" ("identity_id");
|
||||
ALTER TABLE "termix_identity_keys" RENAME TO "p_termix_identity_keys";
|
||||
CREATE TABLE IF NOT EXISTS "termix_identity_ca" (
|
||||
"id" serial PRIMARY KEY,
|
||||
"identity_id" integer NOT NULL UNIQUE,
|
||||
"user_id" varchar(255) NOT NULL,
|
||||
"public_key" text NOT NULL,
|
||||
"private_key" text NOT NULL,
|
||||
"validity_days" integer NOT NULL DEFAULT 90,
|
||||
"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,
|
||||
FOREIGN KEY ("identity_id") REFERENCES "p_termix_identity_identities" ("id") ON DELETE CASCADE
|
||||
);
|
||||
ALTER TABLE "termix_identity_ca" RENAME TO "p_termix_identity_ca";
|
||||
@@ -0,0 +1,146 @@
|
||||
{
|
||||
"version": 1,
|
||||
"tables": {
|
||||
"identities": {
|
||||
"columns": {
|
||||
"id": {
|
||||
"type": "id",
|
||||
"primaryKey": true,
|
||||
"notNull": true
|
||||
},
|
||||
"userId": {
|
||||
"type": "refUser",
|
||||
"length": 255,
|
||||
"notNull": true,
|
||||
"unique": true
|
||||
},
|
||||
"handle": {
|
||||
"type": "varchar",
|
||||
"length": 255,
|
||||
"notNull": true,
|
||||
"unique": true
|
||||
},
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "text",
|
||||
"notNull": true,
|
||||
"defaultNow": true
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "text",
|
||||
"notNull": true,
|
||||
"defaultNow": true
|
||||
}
|
||||
},
|
||||
"indexes": [],
|
||||
"adopts": "termix_identities"
|
||||
},
|
||||
"keys": {
|
||||
"columns": {
|
||||
"id": {
|
||||
"type": "id",
|
||||
"primaryKey": true,
|
||||
"notNull": true
|
||||
},
|
||||
"identityId": {
|
||||
"type": "integer",
|
||||
"notNull": true
|
||||
},
|
||||
"userId": {
|
||||
"type": "refUser",
|
||||
"length": 255,
|
||||
"notNull": true
|
||||
},
|
||||
"publicKey": {
|
||||
"type": "text",
|
||||
"notNull": true
|
||||
},
|
||||
"keyType": {
|
||||
"type": "text",
|
||||
"notNull": true
|
||||
},
|
||||
"algorithm": {
|
||||
"type": "text",
|
||||
"notNull": true
|
||||
},
|
||||
"label": {
|
||||
"type": "text"
|
||||
},
|
||||
"comment": {
|
||||
"type": "text"
|
||||
},
|
||||
"source": {
|
||||
"type": "text",
|
||||
"notNull": true,
|
||||
"defaultValue": "manual"
|
||||
},
|
||||
"credentialId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"enabled": {
|
||||
"type": "boolean",
|
||||
"notNull": true,
|
||||
"defaultValue": true
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "text",
|
||||
"notNull": true,
|
||||
"defaultNow": true
|
||||
}
|
||||
},
|
||||
"indexes": [
|
||||
{
|
||||
"name": "idx_termix_identity_keys_identity",
|
||||
"columns": ["identityId"]
|
||||
}
|
||||
],
|
||||
"adopts": "termix_identity_keys"
|
||||
},
|
||||
"ca": {
|
||||
"columns": {
|
||||
"id": {
|
||||
"type": "id",
|
||||
"primaryKey": true,
|
||||
"notNull": true
|
||||
},
|
||||
"identityId": {
|
||||
"type": "integer",
|
||||
"notNull": true,
|
||||
"unique": true
|
||||
},
|
||||
"userId": {
|
||||
"type": "refUser",
|
||||
"length": 255,
|
||||
"notNull": true
|
||||
},
|
||||
"publicKey": {
|
||||
"type": "text",
|
||||
"notNull": true
|
||||
},
|
||||
"privateKey": {
|
||||
"type": "text",
|
||||
"notNull": true
|
||||
},
|
||||
"validityDays": {
|
||||
"type": "integer",
|
||||
"notNull": true,
|
||||
"defaultValue": 90
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "text",
|
||||
"notNull": true,
|
||||
"defaultNow": true
|
||||
},
|
||||
"updatedAt": {
|
||||
"type": "text",
|
||||
"notNull": true,
|
||||
"defaultNow": true
|
||||
}
|
||||
},
|
||||
"indexes": [],
|
||||
"adopts": "termix_identity_ca"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
-- termix-identity 0001: adopt_termix_identity_tables
|
||||
-- Generated by termix-plugin migrations. Review before committing.
|
||||
-- Hand-edited: keeps the legacy foreign keys the SDK cannot declare
|
||||
-- (keys and ca to their identity, keys to ssh_credentials).
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "termix_identities" (
|
||||
"id" integer PRIMARY KEY AUTOINCREMENT,
|
||||
"user_id" text NOT NULL UNIQUE,
|
||||
"handle" text NOT NULL UNIQUE,
|
||||
"description" text,
|
||||
"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
|
||||
);
|
||||
ALTER TABLE "termix_identities" RENAME TO "p_termix_identity_identities";
|
||||
CREATE TABLE IF NOT EXISTS "termix_identity_keys" (
|
||||
"id" integer PRIMARY KEY AUTOINCREMENT,
|
||||
"identity_id" integer NOT NULL,
|
||||
"user_id" text NOT NULL,
|
||||
"public_key" text NOT NULL,
|
||||
"key_type" text NOT NULL,
|
||||
"algorithm" text NOT NULL,
|
||||
"label" text,
|
||||
"comment" text,
|
||||
"source" text NOT NULL DEFAULT 'manual',
|
||||
"credential_id" integer,
|
||||
"enabled" integer NOT NULL DEFAULT 1,
|
||||
"created_at" text NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE,
|
||||
FOREIGN KEY ("identity_id") REFERENCES "p_termix_identity_identities" ("id") ON DELETE CASCADE,
|
||||
FOREIGN KEY ("credential_id") REFERENCES "ssh_credentials" ("id") ON DELETE SET NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS "idx_termix_identity_keys_identity" ON "termix_identity_keys" ("identity_id");
|
||||
ALTER TABLE "termix_identity_keys" RENAME TO "p_termix_identity_keys";
|
||||
CREATE TABLE IF NOT EXISTS "termix_identity_ca" (
|
||||
"id" integer PRIMARY KEY AUTOINCREMENT,
|
||||
"identity_id" integer NOT NULL UNIQUE,
|
||||
"user_id" text NOT NULL,
|
||||
"public_key" text NOT NULL,
|
||||
"private_key" text NOT NULL,
|
||||
"validity_days" integer NOT NULL DEFAULT 90,
|
||||
"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,
|
||||
FOREIGN KEY ("identity_id") REFERENCES "p_termix_identity_identities" ("id") ON DELETE CASCADE
|
||||
);
|
||||
ALTER TABLE "termix_identity_ca" RENAME TO "p_termix_identity_ca";
|
||||
Reference in new issue
Block a user