refactor(multi-server): replace executeCommand with execAsyncRemote

This commit is contained in:
Mauricio Siu
2024-09-16 00:40:11 -06:00
parent 19295ba746
commit d8d0b60cb3
76 changed files with 622 additions and 19123 deletions

View File

@@ -0,0 +1,81 @@
CREATE TABLE IF NOT EXISTS "server" (
"serverId" text PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"description" text,
"ipAddress" text NOT NULL,
"port" integer NOT NULL,
"username" text DEFAULT 'root' NOT NULL,
"appName" text NOT NULL,
"redisPassword" text DEFAULT 'xYBugfHkULig1iLN' NOT NULL,
"createdAt" text NOT NULL,
"adminId" text NOT NULL,
"sshKeyId" text
);
--> statement-breakpoint
ALTER TABLE "application" ADD COLUMN "serverId" text;--> statement-breakpoint
ALTER TABLE "postgres" ADD COLUMN "serverId" text;--> statement-breakpoint
ALTER TABLE "mariadb" ADD COLUMN "serverId" text;--> statement-breakpoint
ALTER TABLE "mongo" ADD COLUMN "serverId" text;--> statement-breakpoint
ALTER TABLE "mysql" ADD COLUMN "serverId" text;--> statement-breakpoint
ALTER TABLE "deployment" ADD COLUMN "serverId" text;--> statement-breakpoint
ALTER TABLE "redis" ADD COLUMN "serverId" text;--> statement-breakpoint
ALTER TABLE "compose" ADD COLUMN "serverId" text;--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "server" ADD CONSTRAINT "server_adminId_admin_adminId_fk" FOREIGN KEY ("adminId") REFERENCES "public"."admin"("adminId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "server" ADD CONSTRAINT "server_sshKeyId_ssh-key_sshKeyId_fk" FOREIGN KEY ("sshKeyId") REFERENCES "public"."ssh-key"("sshKeyId") ON DELETE set null ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "application" ADD CONSTRAINT "application_serverId_server_serverId_fk" FOREIGN KEY ("serverId") REFERENCES "public"."server"("serverId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "postgres" ADD CONSTRAINT "postgres_serverId_server_serverId_fk" FOREIGN KEY ("serverId") REFERENCES "public"."server"("serverId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "mariadb" ADD CONSTRAINT "mariadb_serverId_server_serverId_fk" FOREIGN KEY ("serverId") REFERENCES "public"."server"("serverId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "mongo" ADD CONSTRAINT "mongo_serverId_server_serverId_fk" FOREIGN KEY ("serverId") REFERENCES "public"."server"("serverId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "mysql" ADD CONSTRAINT "mysql_serverId_server_serverId_fk" FOREIGN KEY ("serverId") REFERENCES "public"."server"("serverId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "deployment" ADD CONSTRAINT "deployment_serverId_server_serverId_fk" FOREIGN KEY ("serverId") REFERENCES "public"."server"("serverId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "redis" ADD CONSTRAINT "redis_serverId_server_serverId_fk" FOREIGN KEY ("serverId") REFERENCES "public"."server"("serverId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "compose" ADD CONSTRAINT "compose_serverId_server_serverId_fk" FOREIGN KEY ("serverId") REFERENCES "public"."server"("serverId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;

View File

@@ -1,18 +0,0 @@
CREATE TABLE IF NOT EXISTS "server" (
"serverId" text PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"description" text,
"ipAddress" text NOT NULL,
"port" integer NOT NULL,
"username" text DEFAULT 'root' NOT NULL,
"appName" text,
"createdAt" text NOT NULL,
"adminId" text NOT NULL,
CONSTRAINT "server_appName_unique" UNIQUE("appName")
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "server" ADD CONSTRAINT "server_adminId_admin_adminId_fk" FOREIGN KEY ("adminId") REFERENCES "public"."admin"("adminId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;

View File

@@ -1,6 +0,0 @@
ALTER TABLE "deployment" ADD COLUMN "serverId" text;--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "deployment" ADD CONSTRAINT "deployment_serverId_server_serverId_fk" FOREIGN KEY ("serverId") REFERENCES "public"."server"("serverId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;

View File

@@ -1,8 +0,0 @@
ALTER TABLE "server" DROP CONSTRAINT "server_appName_unique";--> statement-breakpoint
ALTER TABLE "server" ALTER COLUMN "appName" SET NOT NULL;--> statement-breakpoint
ALTER TABLE "server" ADD COLUMN "sshKeyId" text;--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "server" ADD CONSTRAINT "server_sshKeyId_ssh-key_sshKeyId_fk" FOREIGN KEY ("sshKeyId") REFERENCES "public"."ssh-key"("sshKeyId") ON DELETE set null ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;

View File

@@ -1,13 +0,0 @@
ALTER TABLE "application" ADD COLUMN "serverId" text;--> statement-breakpoint
ALTER TABLE "compose" ADD COLUMN "serverId" text;--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "application" ADD CONSTRAINT "application_serverId_server_serverId_fk" FOREIGN KEY ("serverId") REFERENCES "public"."server"("serverId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "compose" ADD CONSTRAINT "compose_serverId_server_serverId_fk" FOREIGN KEY ("serverId") REFERENCES "public"."server"("serverId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;

View File

@@ -1 +0,0 @@
ALTER TABLE "server" ADD COLUMN "redisPassword" text DEFAULT 'xYBugfHkULig1iLN' NOT NULL;

View File

@@ -1,34 +0,0 @@
ALTER TABLE "postgres" ADD COLUMN "serverId" text;--> statement-breakpoint
ALTER TABLE "mariadb" ADD COLUMN "serverId" text;--> statement-breakpoint
ALTER TABLE "mongo" ADD COLUMN "serverId" text;--> statement-breakpoint
ALTER TABLE "mysql" ADD COLUMN "serverId" text;--> statement-breakpoint
ALTER TABLE "redis" ADD COLUMN "serverId" text;--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "postgres" ADD CONSTRAINT "postgres_serverId_server_serverId_fk" FOREIGN KEY ("serverId") REFERENCES "public"."server"("serverId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "mariadb" ADD CONSTRAINT "mariadb_serverId_server_serverId_fk" FOREIGN KEY ("serverId") REFERENCES "public"."server"("serverId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "mongo" ADD CONSTRAINT "mongo_serverId_server_serverId_fk" FOREIGN KEY ("serverId") REFERENCES "public"."server"("serverId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "mysql" ADD CONSTRAINT "mysql_serverId_server_serverId_fk" FOREIGN KEY ("serverId") REFERENCES "public"."server"("serverId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "redis" ADD CONSTRAINT "redis_serverId_server_serverId_fk" FOREIGN KEY ("serverId") REFERENCES "public"."server"("serverId") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;

View File

@@ -1,5 +1,5 @@
{
"id": "ae3c47b8-c680-4409-a6c6-8570862f1018",
"id": "8a72c5cc-bc93-4cd4-a129-6e86a7889b89",
"prevId": "74cd1475-b79c-4226-b4e6-e5ddb9576025",
"version": "6",
"dialect": "postgresql",
@@ -377,6 +377,12 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"serverId": {
"name": "serverId",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@@ -458,6 +464,19 @@
],
"onDelete": "set null",
"onUpdate": "no action"
},
"application_serverId_server_serverId_fk": {
"name": "application_serverId_server_serverId_fk",
"tableFrom": "application",
"tableTo": "server",
"columnsFrom": [
"serverId"
],
"columnsTo": [
"serverId"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
@@ -584,6 +603,12 @@
"type": "text",
"primaryKey": false,
"notNull": true
},
"serverId": {
"name": "serverId",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@@ -600,6 +625,19 @@
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"postgres_serverId_server_serverId_fk": {
"name": "postgres_serverId_server_serverId_fk",
"tableFrom": "postgres",
"tableTo": "server",
"columnsFrom": [
"serverId"
],
"columnsTo": [
"serverId"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
@@ -1221,6 +1259,12 @@
"type": "text",
"primaryKey": false,
"notNull": true
},
"serverId": {
"name": "serverId",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@@ -1237,6 +1281,19 @@
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"mariadb_serverId_server_serverId_fk": {
"name": "mariadb_serverId_server_serverId_fk",
"tableFrom": "mariadb",
"tableTo": "server",
"columnsFrom": [
"serverId"
],
"columnsTo": [
"serverId"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
@@ -1357,6 +1414,12 @@
"type": "text",
"primaryKey": false,
"notNull": true
},
"serverId": {
"name": "serverId",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@@ -1373,6 +1436,19 @@
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"mongo_serverId_server_serverId_fk": {
"name": "mongo_serverId_server_serverId_fk",
"tableFrom": "mongo",
"tableTo": "server",
"columnsFrom": [
"serverId"
],
"columnsTo": [
"serverId"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
@@ -1505,6 +1581,12 @@
"type": "text",
"primaryKey": false,
"notNull": true
},
"serverId": {
"name": "serverId",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@@ -1521,6 +1603,19 @@
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"mysql_serverId_server_serverId_fk": {
"name": "mysql_serverId_server_serverId_fk",
"tableFrom": "mysql",
"tableTo": "server",
"columnsFrom": [
"serverId"
],
"columnsTo": [
"serverId"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
@@ -1797,6 +1892,12 @@
"primaryKey": false,
"notNull": false
},
"serverId": {
"name": "serverId",
"type": "text",
"primaryKey": false,
"notNull": false
},
"createdAt": {
"name": "createdAt",
"type": "text",
@@ -1831,6 +1932,19 @@
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"deployment_serverId_server_serverId_fk": {
"name": "deployment_serverId_server_serverId_fk",
"tableFrom": "deployment",
"tableTo": "server",
"columnsFrom": [
"serverId"
],
"columnsTo": [
"serverId"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
@@ -2413,6 +2527,12 @@
"type": "text",
"primaryKey": false,
"notNull": true
},
"serverId": {
"name": "serverId",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@@ -2429,6 +2549,19 @@
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"redis_serverId_server_serverId_fk": {
"name": "redis_serverId_server_serverId_fk",
"tableFrom": "redis",
"tableTo": "server",
"columnsFrom": [
"serverId"
],
"columnsTo": [
"serverId"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
@@ -2660,6 +2793,12 @@
"type": "text",
"primaryKey": false,
"notNull": false
},
"serverId": {
"name": "serverId",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@@ -2728,6 +2867,19 @@
],
"onDelete": "set null",
"onUpdate": "no action"
},
"compose_serverId_server_serverId_fk": {
"name": "compose_serverId_server_serverId_fk",
"tableFrom": "compose",
"tableTo": "server",
"columnsFrom": [
"serverId"
],
"columnsTo": [
"serverId"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
@@ -3447,7 +3599,14 @@
"name": "appName",
"type": "text",
"primaryKey": false,
"notNull": false
"notNull": true
},
"redisPassword": {
"name": "redisPassword",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'xYBugfHkULig1iLN'"
},
"createdAt": {
"name": "createdAt",
@@ -3460,6 +3619,12 @@
"type": "text",
"primaryKey": false,
"notNull": true
},
"sshKeyId": {
"name": "sshKeyId",
"type": "text",
"primaryKey": false,
"notNull": false
}
},
"indexes": {},
@@ -3476,18 +3641,23 @@
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"server_sshKeyId_ssh-key_sshKeyId_fk": {
"name": "server_sshKeyId_ssh-key_sshKeyId_fk",
"tableFrom": "server",
"tableTo": "ssh-key",
"columnsFrom": [
"sshKeyId"
],
"columnsTo": [
"sshKeyId"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"server_appName_unique": {
"name": "server_appName_unique",
"nullsNotDistinct": false,
"columns": [
"appName"
]
}
}
"uniqueConstraints": {}
}
},
"enums": {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -264,43 +264,8 @@
{
"idx": 37,
"version": "6",
"when": 1725773488051,
"tag": "0037_small_adam_warlock",
"breakpoints": true
},
{
"idx": 38,
"version": "6",
"when": 1725773967628,
"tag": "0038_thankful_magneto",
"breakpoints": true
},
{
"idx": 39,
"version": "6",
"when": 1725776089878,
"tag": "0039_military_doctor_faustus",
"breakpoints": true
},
{
"idx": 40,
"version": "6",
"when": 1725812869228,
"tag": "0040_bent_santa_claus",
"breakpoints": true
},
{
"idx": 41,
"version": "6",
"when": 1725830160928,
"tag": "0041_mute_polaris",
"breakpoints": true
},
{
"idx": 42,
"version": "6",
"when": 1725856996201,
"tag": "0042_wandering_inhumans",
"when": 1726462845274,
"tag": "0037_quick_callisto",
"breakpoints": true
}
]