Merge branch 'dev' into feat/config-portability

# Conflicts:
#	apps/nextjs/src/app/[locale]/init/_steps/start/init-start.tsx
#	apps/nextjs/src/app/[locale]/manage/tools/logs/terminal.tsx
#	packages/api/src/router/docker/docker-router.ts
#	packages/api/src/router/test/docker/docker-router.spec.ts
#	packages/db/migrations/mysql/meta/0039_snapshot.json
#	packages/db/migrations/mysql/meta/_journal.json
#	packages/db/migrations/postgresql/meta/0005_snapshot.json
#	packages/db/migrations/postgresql/meta/_journal.json
#	packages/db/migrations/sqlite/meta/0037_snapshot.json
#	packages/db/migrations/sqlite/meta/_journal.json
This commit is contained in:
Thomas Camlong committed 2026-06-06 09:32:41 +02:00
commit 1f7b7f0516
247 files changed
+16920 -3224

No files matched your search

@@ -0,0 +1,2 @@
ALTER TABLE `user` ADD `completed_manage_tour` boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE `user` ADD `completed_board_tour` boolean DEFAULT false NOT NULL;
@@ -0,0 +1,17 @@
CREATE TABLE `docker_app_source` (
`host` varchar(512) NOT NULL,
`container_id` varchar(128) NOT NULL,
`external_id` varchar(512) NOT NULL,
`app_id` varchar(64) NOT NULL,
`board_id` varchar(64) NOT NULL,
`item_id` varchar(64),
`integration_id` varchar(64),
`updated_at` timestamp NOT NULL,
CONSTRAINT `docker_app_source_host_container_id_pk` PRIMARY KEY(`host`,`container_id`)
);
--> statement-breakpoint
ALTER TABLE `docker_app_source` ADD CONSTRAINT `docker_app_source_app_id_app_id_fk` FOREIGN KEY (`app_id`) REFERENCES `app`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE `docker_app_source` ADD CONSTRAINT `docker_app_source_board_id_board_id_fk` FOREIGN KEY (`board_id`) REFERENCES `board`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE `docker_app_source` ADD CONSTRAINT `docker_app_source_item_id_item_id_fk` FOREIGN KEY (`item_id`) REFERENCES `item`(`id`) ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE `docker_app_source` ADD CONSTRAINT `docker_app_source_integration_id_integration_id_fk` FOREIGN KEY (`integration_id`) REFERENCES `integration`(`id`) ON DELETE set null ON UPDATE no action;--> statement-breakpoint
CREATE INDEX `docker_app_source__external_id_idx` ON `docker_app_source` (`host`,`external_id`);
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
@@ -278,8 +278,15 @@
{
"idx": 39,
"version": "5",
"when": 1779199104477,
"tag": "0039_add_user_onboarding_tour_status",
"breakpoints": true
},
{
"idx": 40,
"version": "5",
"when": 1780490691902,
"tag": "0039_add_docker_app_source",
"tag": "0040_add_docker_app_source",
"breakpoints": true
}
]
@@ -0,0 +1,2 @@
ALTER TABLE "user" ADD COLUMN "completed_manage_tour" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "user" ADD COLUMN "completed_board_tour" boolean DEFAULT false NOT NULL;
@@ -0,0 +1,17 @@
CREATE TABLE "docker_app_source" (
"host" varchar(512) NOT NULL,
"container_id" varchar(128) NOT NULL,
"external_id" varchar(512) NOT NULL,
"app_id" varchar(64) NOT NULL,
"board_id" varchar(64) NOT NULL,
"item_id" varchar(64),
"integration_id" varchar(64),
"updated_at" timestamp NOT NULL,
CONSTRAINT "docker_app_source_host_container_id_pk" PRIMARY KEY("host","container_id")
);
--> statement-breakpoint
ALTER TABLE "docker_app_source" ADD CONSTRAINT "docker_app_source_app_id_app_id_fk" FOREIGN KEY ("app_id") REFERENCES "public"."app"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "docker_app_source" ADD CONSTRAINT "docker_app_source_board_id_board_id_fk" FOREIGN KEY ("board_id") REFERENCES "public"."board"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "docker_app_source" ADD CONSTRAINT "docker_app_source_item_id_item_id_fk" FOREIGN KEY ("item_id") REFERENCES "public"."item"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "docker_app_source" ADD CONSTRAINT "docker_app_source_integration_id_integration_id_fk" FOREIGN KEY ("integration_id") REFERENCES "public"."integration"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "docker_app_source__external_id_idx" ON "docker_app_source" USING btree ("host","external_id");
@@ -1,5 +1,5 @@
{
"id": "ac193a04-5dd9-48ec-9d85-654e6610fab8",
"id": "2869b3b7-af54-4fbc-a953-766387ec2e3d",
"prevId": "ddg-bangs-pg-0004",
"version": "7",
"dialect": "postgresql",
@@ -97,12 +97,8 @@
"name": "account_user_id_user_id_fk",
"tableFrom": "account",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -110,10 +106,7 @@
"compositePrimaryKeys": {
"account_provider_provider_account_id_pk": {
"name": "account_provider_provider_account_id_pk",
"columns": [
"provider",
"provider_account_id"
]
"columns": ["provider", "provider_account_id"]
}
},
"uniqueConstraints": {},
@@ -150,12 +143,8 @@
"name": "apiKey_user_id_user_id_fk",
"tableFrom": "apiKey",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -244,12 +233,8 @@
"name": "boardGroupPermission_board_id_board_id_fk",
"tableFrom": "boardGroupPermission",
"tableTo": "board",
"columnsFrom": [
"board_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["board_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -257,12 +242,8 @@
"name": "boardGroupPermission_group_id_group_id_fk",
"tableFrom": "boardGroupPermission",
"tableTo": "group",
"columnsFrom": [
"group_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["group_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -270,11 +251,7 @@
"compositePrimaryKeys": {
"boardGroupPermission_board_id_group_id_permission_pk": {
"name": "boardGroupPermission_board_id_group_id_permission_pk",
"columns": [
"board_id",
"group_id",
"permission"
]
"columns": ["board_id", "group_id", "permission"]
}
},
"uniqueConstraints": {},
@@ -311,12 +288,8 @@
"name": "boardUserPermission_board_id_board_id_fk",
"tableFrom": "boardUserPermission",
"tableTo": "board",
"columnsFrom": [
"board_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["board_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -324,12 +297,8 @@
"name": "boardUserPermission_user_id_user_id_fk",
"tableFrom": "boardUserPermission",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -337,11 +306,7 @@
"compositePrimaryKeys": {
"boardUserPermission_board_id_user_id_permission_pk": {
"name": "boardUserPermission_board_id_user_id_permission_pk",
"columns": [
"board_id",
"user_id",
"permission"
]
"columns": ["board_id", "user_id", "permission"]
}
},
"uniqueConstraints": {},
@@ -483,12 +448,8 @@
"name": "board_creator_id_user_id_fk",
"tableFrom": "board",
"tableTo": "user",
"columnsFrom": [
"creator_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["creator_id"],
"columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
}
@@ -498,9 +459,7 @@
"board_name_unique": {
"name": "board_name_unique",
"nullsNotDistinct": false,
"columns": [
"name"
]
"columns": ["name"]
}
},
"policies": {},
@@ -539,150 +498,6 @@
"checkConstraints": {},
"isRLSEnabled": false
},
"public.docker_app_source": {
"name": "docker_app_source",
"schema": "",
"columns": {
"host": {
"name": "host",
"type": "varchar(512)",
"primaryKey": false,
"notNull": true
},
"container_id": {
"name": "container_id",
"type": "varchar(128)",
"primaryKey": false,
"notNull": true
},
"external_id": {
"name": "external_id",
"type": "varchar(512)",
"primaryKey": false,
"notNull": true
},
"app_id": {
"name": "app_id",
"type": "varchar(64)",
"primaryKey": false,
"notNull": true
},
"board_id": {
"name": "board_id",
"type": "varchar(64)",
"primaryKey": false,
"notNull": true
},
"item_id": {
"name": "item_id",
"type": "varchar(64)",
"primaryKey": false,
"notNull": false
},
"integration_id": {
"name": "integration_id",
"type": "varchar(64)",
"primaryKey": false,
"notNull": false
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true
}
},
"indexes": {
"docker_app_source__external_id_idx": {
"name": "docker_app_source__external_id_idx",
"columns": [
{
"expression": "host",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "external_id",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {
"docker_app_source_app_id_app_id_fk": {
"name": "docker_app_source_app_id_app_id_fk",
"tableFrom": "docker_app_source",
"tableTo": "app",
"columnsFrom": [
"app_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"docker_app_source_board_id_board_id_fk": {
"name": "docker_app_source_board_id_board_id_fk",
"tableFrom": "docker_app_source",
"tableTo": "board",
"columnsFrom": [
"board_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"docker_app_source_item_id_item_id_fk": {
"name": "docker_app_source_item_id_item_id_fk",
"tableFrom": "docker_app_source",
"tableTo": "item",
"columnsFrom": [
"item_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"docker_app_source_integration_id_integration_id_fk": {
"name": "docker_app_source_integration_id_integration_id_fk",
"tableFrom": "docker_app_source",
"tableTo": "integration",
"columnsFrom": [
"integration_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"docker_app_source_host_container_id_pk": {
"name": "docker_app_source_host_container_id_pk",
"columns": [
"host",
"container_id"
]
}
},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.groupMember": {
"name": "groupMember",
"schema": "",
@@ -706,12 +521,8 @@
"name": "groupMember_group_id_group_id_fk",
"tableFrom": "groupMember",
"tableTo": "group",
"columnsFrom": [
"group_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["group_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -719,12 +530,8 @@
"name": "groupMember_user_id_user_id_fk",
"tableFrom": "groupMember",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -732,10 +539,7 @@
"compositePrimaryKeys": {
"groupMember_group_id_user_id_pk": {
"name": "groupMember_group_id_user_id_pk",
"columns": [
"group_id",
"user_id"
]
"columns": ["group_id", "user_id"]
}
},
"uniqueConstraints": {},
@@ -766,12 +570,8 @@
"name": "groupPermission_group_id_group_id_fk",
"tableFrom": "groupPermission",
"tableTo": "group",
"columnsFrom": [
"group_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["group_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -829,12 +629,8 @@
"name": "group_owner_id_user_id_fk",
"tableFrom": "group",
"tableTo": "user",
"columnsFrom": [
"owner_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["owner_id"],
"columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
},
@@ -842,12 +638,8 @@
"name": "group_home_board_id_board_id_fk",
"tableFrom": "group",
"tableTo": "board",
"columnsFrom": [
"home_board_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["home_board_id"],
"columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
},
@@ -855,12 +647,8 @@
"name": "group_mobile_home_board_id_board_id_fk",
"tableFrom": "group",
"tableTo": "board",
"columnsFrom": [
"mobile_home_board_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["mobile_home_board_id"],
"columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
}
@@ -870,9 +658,7 @@
"group_name_unique": {
"name": "group_name_unique",
"nullsNotDistinct": false,
"columns": [
"name"
]
"columns": ["name"]
}
},
"policies": {},
@@ -945,12 +731,8 @@
"name": "icon_icon_repository_id_iconRepository_id_fk",
"tableFrom": "icon",
"tableTo": "iconRepository",
"columnsFrom": [
"icon_repository_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["icon_repository_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -990,12 +772,8 @@
"name": "integrationGroupPermissions_integration_id_integration_id_fk",
"tableFrom": "integrationGroupPermissions",
"tableTo": "integration",
"columnsFrom": [
"integration_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["integration_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -1003,12 +781,8 @@
"name": "integrationGroupPermissions_group_id_group_id_fk",
"tableFrom": "integrationGroupPermissions",
"tableTo": "group",
"columnsFrom": [
"group_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["group_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -1016,11 +790,7 @@
"compositePrimaryKeys": {
"integration_group_permission__pk": {
"name": "integration_group_permission__pk",
"columns": [
"integration_id",
"group_id",
"permission"
]
"columns": ["integration_id", "group_id", "permission"]
}
},
"uniqueConstraints": {},
@@ -1051,12 +821,8 @@
"name": "integration_item_item_id_item_id_fk",
"tableFrom": "integration_item",
"tableTo": "item",
"columnsFrom": [
"item_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["item_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -1064,12 +830,8 @@
"name": "integration_item_integration_id_integration_id_fk",
"tableFrom": "integration_item",
"tableTo": "integration",
"columnsFrom": [
"integration_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["integration_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -1077,10 +839,7 @@
"compositePrimaryKeys": {
"integration_item_item_id_integration_id_pk": {
"name": "integration_item_item_id_integration_id_pk",
"columns": [
"item_id",
"integration_id"
]
"columns": ["item_id", "integration_id"]
}
},
"uniqueConstraints": {},
@@ -1154,12 +913,8 @@
"name": "integrationSecret_integration_id_integration_id_fk",
"tableFrom": "integrationSecret",
"tableTo": "integration",
"columnsFrom": [
"integration_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["integration_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -1167,10 +922,7 @@
"compositePrimaryKeys": {
"integrationSecret_integration_id_kind_pk": {
"name": "integrationSecret_integration_id_kind_pk",
"columns": [
"integration_id",
"kind"
]
"columns": ["integration_id", "kind"]
}
},
"uniqueConstraints": {},
@@ -1207,12 +959,8 @@
"name": "integrationUserPermission_integration_id_integration_id_fk",
"tableFrom": "integrationUserPermission",
"tableTo": "integration",
"columnsFrom": [
"integration_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["integration_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -1220,12 +968,8 @@
"name": "integrationUserPermission_user_id_user_id_fk",
"tableFrom": "integrationUserPermission",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -1233,11 +977,7 @@
"compositePrimaryKeys": {
"integrationUserPermission_integration_id_user_id_permission_pk": {
"name": "integrationUserPermission_integration_id_user_id_permission_pk",
"columns": [
"integration_id",
"user_id",
"permission"
]
"columns": ["integration_id", "user_id", "permission"]
}
},
"uniqueConstraints": {},
@@ -1302,12 +1042,8 @@
"name": "integration_app_id_app_id_fk",
"tableFrom": "integration",
"tableTo": "app",
"columnsFrom": [
"app_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["app_id"],
"columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
}
@@ -1353,12 +1089,8 @@
"name": "invite_creator_id_user_id_fk",
"tableFrom": "invite",
"tableTo": "user",
"columnsFrom": [
"creator_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["creator_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -1368,9 +1100,7 @@
"invite_token_unique": {
"name": "invite_token_unique",
"nullsNotDistinct": false,
"columns": [
"token"
]
"columns": ["token"]
}
},
"policies": {},
@@ -1430,12 +1160,8 @@
"name": "item_layout_item_id_item_id_fk",
"tableFrom": "item_layout",
"tableTo": "item",
"columnsFrom": [
"item_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["item_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -1443,12 +1169,8 @@
"name": "item_layout_section_id_section_id_fk",
"tableFrom": "item_layout",
"tableTo": "section",
"columnsFrom": [
"section_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["section_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -1456,12 +1178,8 @@
"name": "item_layout_layout_id_layout_id_fk",
"tableFrom": "item_layout",
"tableTo": "layout",
"columnsFrom": [
"layout_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["layout_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -1469,11 +1187,7 @@
"compositePrimaryKeys": {
"item_layout_item_id_section_id_layout_id_pk": {
"name": "item_layout_item_id_section_id_layout_id_pk",
"columns": [
"item_id",
"section_id",
"layout_id"
]
"columns": ["item_id", "section_id", "layout_id"]
}
},
"uniqueConstraints": {},
@@ -1524,12 +1238,8 @@
"name": "item_board_id_board_id_fk",
"tableFrom": "item",
"tableTo": "board",
"columnsFrom": [
"board_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["board_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -1582,12 +1292,8 @@
"name": "layout_board_id_board_id_fk",
"tableFrom": "layout",
"tableTo": "board",
"columnsFrom": [
"board_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["board_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -1652,12 +1358,8 @@
"name": "media_creator_id_user_id_fk",
"tableFrom": "media",
"tableTo": "user",
"columnsFrom": [
"creator_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["creator_id"],
"columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
}
@@ -1759,12 +1461,8 @@
"name": "search_engine_integration_id_integration_id_fk",
"tableFrom": "search_engine",
"tableTo": "integration",
"columnsFrom": [
"integration_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["integration_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -1774,9 +1472,7 @@
"search_engine_short_unique": {
"name": "search_engine_short_unique",
"nullsNotDistinct": false,
"columns": [
"short"
]
"columns": ["short"]
}
},
"policies": {},
@@ -1813,12 +1509,8 @@
"name": "section_collapse_state_user_id_user_id_fk",
"tableFrom": "section_collapse_state",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -1826,12 +1518,8 @@
"name": "section_collapse_state_section_id_section_id_fk",
"tableFrom": "section_collapse_state",
"tableTo": "section",
"columnsFrom": [
"section_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["section_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -1839,10 +1527,7 @@
"compositePrimaryKeys": {
"section_collapse_state_user_id_section_id_pk": {
"name": "section_collapse_state_user_id_section_id_pk",
"columns": [
"user_id",
"section_id"
]
"columns": ["user_id", "section_id"]
}
},
"uniqueConstraints": {},
@@ -1903,12 +1588,8 @@
"name": "section_layout_section_id_section_id_fk",
"tableFrom": "section_layout",
"tableTo": "section",
"columnsFrom": [
"section_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["section_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -1916,12 +1597,8 @@
"name": "section_layout_layout_id_layout_id_fk",
"tableFrom": "section_layout",
"tableTo": "layout",
"columnsFrom": [
"layout_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["layout_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -1929,12 +1606,8 @@
"name": "section_layout_parent_section_id_section_id_fk",
"tableFrom": "section_layout",
"tableTo": "section",
"columnsFrom": [
"parent_section_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["parent_section_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -1942,10 +1615,7 @@
"compositePrimaryKeys": {
"section_layout_section_id_layout_id_pk": {
"name": "section_layout_section_id_layout_id_pk",
"columns": [
"section_id",
"layout_id"
]
"columns": ["section_id", "layout_id"]
}
},
"uniqueConstraints": {},
@@ -2007,12 +1677,8 @@
"name": "section_board_id_board_id_fk",
"tableFrom": "section",
"tableTo": "board",
"columnsFrom": [
"board_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["board_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -2048,9 +1714,7 @@
"serverSetting_settingKey_unique": {
"name": "serverSetting_settingKey_unique",
"nullsNotDistinct": false,
"columns": [
"setting_key"
]
"columns": ["setting_key"]
}
},
"policies": {},
@@ -2102,12 +1766,8 @@
"name": "session_user_id_user_id_fk",
"tableFrom": "session",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -2217,6 +1877,20 @@
"primaryKey": false,
"notNull": true,
"default": false
},
"completed_manage_tour": {
"name": "completed_manage_tour",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"completed_board_tour": {
"name": "completed_board_tour",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
}
},
"indexes": {},
@@ -2225,12 +1899,8 @@
"name": "user_home_board_id_board_id_fk",
"tableFrom": "user",
"tableTo": "board",
"columnsFrom": [
"home_board_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["home_board_id"],
"columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
},
@@ -2238,12 +1908,8 @@
"name": "user_mobile_home_board_id_board_id_fk",
"tableFrom": "user",
"tableTo": "board",
"columnsFrom": [
"mobile_home_board_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["mobile_home_board_id"],
"columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
},
@@ -2251,12 +1917,8 @@
"name": "user_default_search_engine_id_search_engine_id_fk",
"tableFrom": "user",
"tableTo": "search_engine",
"columnsFrom": [
"default_search_engine_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["default_search_engine_id"],
"columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
}
@@ -2295,10 +1957,7 @@
"compositePrimaryKeys": {
"verificationToken_identifier_token_pk": {
"name": "verificationToken_identifier_token_pk",
"columns": [
"identifier",
"token"
]
"columns": ["identifier", "token"]
}
},
"uniqueConstraints": {},
@@ -2334,10 +1993,7 @@
"compositePrimaryKeys": {
"trusted_certificate_hostname_hostname_thumbprint_pk": {
"name": "trusted_certificate_hostname_hostname_thumbprint_pk",
"columns": [
"hostname",
"thumbprint"
]
"columns": ["hostname", "thumbprint"]
}
},
"uniqueConstraints": {},
@@ -2357,4 +2013,4 @@
"schemas": {},
"tables": {}
}
}
}
File diff suppressed because it is too large. Load diff
@@ -40,8 +40,15 @@
{
"idx": 5,
"version": "7",
"when": 1779199097716,
"tag": "0005_add_user_onboarding_tour_status",
"breakpoints": true
},
{
"idx": 6,
"version": "7",
"when": 1780490693344,
"tag": "0005_add_docker_app_source",
"tag": "0006_add_docker_app_source",
"breakpoints": true
}
]
+304 -6
View File
@@ -1,29 +1,38 @@
import SuperJSON from "superjson";
import { createId, objectKeys } from "@homarr/common";
import {
createDocumentationLink,
credentialsAdminGroup,
defaultBookmarkApps,
everyoneGroup,
getIntegrationDefaultUrl,
getIntegrationName,
integrationDefs,
integrationKinds,
} from "@homarr/definitions";
import type { WidgetKind } from "@homarr/definitions";
import { defaultServerSettings, defaultServerSettingsKeys } from "@homarr/server-settings";
import type { Database } from "..";
import { eq } from "..";
import { getMaxGroupPositionAsync } from "../queries";
import { getMaxGroupPositionAsync, placeAllWidgetsAsync } from "../queries";
import {
getServerSettingByKeyAsync,
insertServerSettingByKeyAsync,
updateServerSettingByKeyAsync,
} from "../queries/server-setting";
import {
apps,
boards,
groupMembers,
groupPermissions,
groups,
integrationItems,
integrations,
itemLayouts,
items,
layouts,
onboarding,
searchEngines,
@@ -32,14 +41,26 @@ import {
} from "../schema";
import type { Integration } from "../schema";
const isTruthyEnv = (value: string | undefined) =>
["1", "yes", "t", "true"].includes((value ?? "").toLowerCase());
export const seedDataAsync = async (db: Database) => {
if (isTruthyEnv(process.env.UNSAFE_ENABLE_MOCK_INTEGRATION)) {
console.warn(
"UNSAFE_ENABLE_MOCK_INTEGRATION is enabled: mock integration is available in the UI. Disable by setting UNSAFE_ENABLE_MOCK_INTEGRATION=false.",
);
}
await seedEveryoneGroupAsync(db);
await seedOnboardingAsync(db);
await seedServerSettingsAsync(db);
await seedDefaultSearchEnginesAsync(db);
await seedDefaultIntegrationsAsync(db);
await seedDefaultAppsAsync(db);
await seedDefaultBoardAsync(db);
await seedBoardWidgetsAsync(db);
if (process.env.DEMO_MODE === "true") {
if (isTruthyEnv(process.env.DEMO_MODE)) {
await seedDemoUserAsync(db);
}
};
@@ -209,6 +230,192 @@ const seedDefaultIntegrationsAsync = async (db: Database) => {
console.log(`Created ${createdCount} default integrations through seeding process`);
};
const seedDefaultAppsAsync = async (db: Database) => {
const existingApps = await db.$count(apps);
if (existingApps > 0) {
console.log("Skipping seeding of default apps as some already exist");
return;
}
for (const app of defaultBookmarkApps) {
await db.insert(apps).values({
id: createId(),
name: app.name,
iconUrl: app.iconUrl,
href: app.href,
});
}
console.log(`Created ${defaultBookmarkApps.length} default apps through seeding process`);
};
const seedDefaultBoardAsync = async (db: Database) => {
const existingBoard = await db.query.boards.findFirst();
if (existingBoard) {
console.log("Skipping seeding of default board as one already exists");
return;
}
const boardId = createId();
await db.insert(boards).values({
id: boardId,
name: "dashboard",
isPublic: false,
});
await db.insert(sections).values({
id: createId(),
kind: "empty",
xOffset: 0,
yOffset: 0,
boardId,
});
await db.insert(layouts).values({
id: createId(),
name: "Base",
columnCount: 10,
breakpoint: 0,
boardId,
});
const everyoneGroupRow = await db.query.groups.findFirst({
where: eq(groups.name, everyoneGroup),
});
if (everyoneGroupRow) {
await db.update(groups).set({ homeBoardId: boardId }).where(eq(groups.id, everyoneGroupRow.id));
console.log("Set default board as home board for everyone group");
}
console.log("Created default board 'dashboard' through seed");
};
interface DemoWidget {
kind: WidgetKind;
width: number;
height: number;
needsIntegration: boolean;
options?: Record<string, unknown>;
}
const demoApps = [
{
name: "Sonarr",
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/sonarr.svg",
href: "https://sonarr.tv",
},
{
name: "Radarr",
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/radarr.svg",
href: "https://radarr.video",
},
{
name: "Plex",
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/plex.svg",
href: "https://plex.tv",
},
{
name: "Jellyfin",
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/jellyfin.svg",
href: "https://jellyfin.org",
},
{
name: "Proxmox",
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/proxmox.svg",
href: "https://proxmox.com",
},
{
name: "Pi-hole",
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/pi-hole.svg",
href: "https://pi-hole.net",
},
{
name: "Grafana",
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/grafana.svg",
href: "https://grafana.com",
},
{
name: "Portainer",
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/portainer.svg",
href: "https://portainer.io",
},
{
name: "Home Assistant",
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/home-assistant.svg",
href: "https://home-assistant.io",
},
{
name: "Nextcloud",
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/nextcloud.svg",
href: "https://nextcloud.com",
},
{
name: "qBittorrent",
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/qbittorrent.svg",
href: "https://qbittorrent.org",
},
{
name: "Overseerr",
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/overseerr.svg",
href: "https://overseerr.dev",
},
] as const;
const buildDemoWidgets = (appIds: string[]): DemoWidget[] => [
// Row 1: calendar + downloads + clock = 12
{ kind: "calendar", width: 5, height: 3, needsIntegration: true },
{ kind: "downloads", width: 5, height: 3, needsIntegration: true },
{ kind: "clock", width: 2, height: 1, needsIntegration: false },
// Row 2: healthMonitoring + bookmarks = 12
{ kind: "healthMonitoring", width: 6, height: 3, needsIntegration: true },
{
kind: "bookmarks",
width: 6,
height: 3,
needsIntegration: false,
options: { title: "Homelab", items: appIds, layout: "grid", openNewTab: true },
},
// Row 3: mediaServer + mediaTranscoding + dnsHoleSummary = 12
{ kind: "mediaServer", width: 3, height: 2, needsIntegration: true },
{ kind: "mediaTranscoding", width: 3, height: 2, needsIntegration: true },
{ kind: "dnsHoleSummary", width: 6, height: 2, needsIntegration: true },
// Row 4: dnsHoleControls + mediaReleases + notifications = 12
{ kind: "dnsHoleControls", width: 2, height: 1, needsIntegration: true },
{ kind: "mediaReleases", width: 4, height: 2, needsIntegration: true },
{ kind: "notifications", width: 6, height: 2, needsIntegration: true },
// Row 5: requestList + requestStats + indexerManager = 12
{ kind: "mediaRequests-requestList", width: 4, height: 3, needsIntegration: true },
{ kind: "mediaRequests-requestStats", width: 4, height: 2, needsIntegration: true },
{ kind: "indexerManager", width: 4, height: 2, needsIntegration: true },
// Row 6: networkControllerSummary + networkControllerStatus + rssFeed = 12
{ kind: "networkControllerSummary", width: 3, height: 2, needsIntegration: true },
{ kind: "networkControllerStatus", width: 3, height: 2, needsIntegration: true },
{
kind: "rssFeed",
width: 6,
height: 2,
needsIntegration: false,
options: {
feedUrls: ["https://selfh.st/rss/", "https://hnrss.org/newest?q=self-hosted"],
maximumAmountPosts: 20,
textLinesClamp: 2,
hideDescription: false,
},
},
// Row 7-8: app widgets (2x1 each, 6 per row = 12)
...appIds.map(
(appId): DemoWidget => ({
kind: "app",
width: 2,
height: 1,
needsIntegration: false,
options: { appId, openInNewTab: true, showTitle: true, pingEnabled: false },
}),
),
// Row 9: notebook + dockerContainers + weather = 12
{ kind: "notebook", width: 4, height: 4, needsIntegration: false },
{ kind: "dockerContainers", width: 6, height: 2, needsIntegration: false },
{ kind: "weather", width: 2, height: 1, needsIntegration: false },
];
const seedDemoUserAsync = async (db: Database) => {
const existingUser = await db.query.users.findFirst({
where: eq(users.name, "demo"),
@@ -225,7 +432,7 @@ const seedDemoUserAsync = async (db: Database) => {
id: userId,
name: "demo",
email: "demo@example.com",
password: "$2b$10$c5AaQb0oj32/bui5Z55PyOb7pY.iEkXYqgdD8MjS9LjSjLMeOkZu2",
password: "$2b$10$odRXt5e95kSQV5Axmk/FeO6GVOxuRQQ8NnRcBA78Wg4V3kZxPY68u",
});
const maxPosition = await getMaxGroupPositionAsync(db);
@@ -250,6 +457,27 @@ const seedDemoUserAsync = async (db: Database) => {
previousStep: "settings",
});
const integrationId = createId();
await db.insert(integrations).values({
id: integrationId,
name: "Demo Integration",
url: "https://demo.homarr.dev",
kind: "mock",
appId: null,
});
const appIds: string[] = [];
for (const app of demoApps) {
const appId = createId();
appIds.push(appId);
await db.insert(apps).values({
id: appId,
name: app.name,
iconUrl: app.iconUrl,
href: app.href,
});
}
const boardId = createId();
await db.insert(boards).values({
id: boardId,
@@ -257,23 +485,93 @@ const seedDemoUserAsync = async (db: Database) => {
isPublic: false,
creatorId: userId,
});
const sectionId = createId();
await db.insert(sections).values({
id: createId(),
id: sectionId,
kind: "empty",
xOffset: 0,
yOffset: 0,
boardId,
});
const layoutId = createId();
await db.insert(layouts).values({
id: createId(),
id: layoutId,
name: "Base",
columnCount: 12,
breakpoint: 0,
boardId,
});
const demoWidgets = buildDemoWidgets(appIds);
let xOffset = 0;
let yOffset = 0;
let rowMaxHeight = 0;
for (const widget of demoWidgets) {
if (xOffset + widget.width > 12) {
xOffset = 0;
yOffset += rowMaxHeight;
rowMaxHeight = 0;
}
rowMaxHeight = Math.max(rowMaxHeight, widget.height);
const itemId = createId();
await db.insert(items).values({
id: itemId,
boardId,
kind: widget.kind,
...(widget.options ? { options: SuperJSON.stringify(widget.options) } : {}),
});
await db.insert(itemLayouts).values({
itemId,
sectionId,
layoutId,
xOffset,
yOffset,
width: widget.width,
height: widget.height,
});
if (widget.needsIntegration) {
await db.insert(integrationItems).values({
itemId,
integrationId,
});
}
xOffset += widget.width;
}
await db.update(users).set({ homeBoardId: boardId }).where(eq(users.id, userId));
console.log(
"Your instance has enabled demo mode. Homarr therefore created example data for your demo. You can disable demo mode anytime by setting the env 'DEMO_MODE' to 'false' or unset it.",
"Demo mode enabled: created demo user, mock integration, and sample board with widgets. Disable by setting DEMO_MODE=false.",
);
};
const seedBoardWidgetsAsync = async (db: Database) => {
const existingItems = await db.$count(items);
if (existingItems > 0) {
console.log("Skipping seeding of board widgets as some already exist");
return;
}
const board = await db.query.boards.findFirst({
with: { sections: true, layouts: true },
});
if (!board) return;
const section = board.sections.find((sec) => sec.kind === "empty");
const layout = board.layouts[0];
if (!section || !layout) return;
const allIntegrations = await db.query.integrations.findMany();
const allApps = await db.query.apps.findMany();
const count = await placeAllWidgetsAsync(
db,
{ boardId: board.id, sectionId: section.id, layoutId: layout.id, columnCount: layout.columnCount },
allIntegrations,
allApps,
);
console.log(`Placed ${count} widgets on board`);
};
@@ -0,0 +1,2 @@
ALTER TABLE `user` ADD `completed_manage_tour` integer DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE `user` ADD `completed_board_tour` integer DEFAULT false NOT NULL;
@@ -0,0 +1,17 @@
CREATE TABLE `docker_app_source` (
`host` text NOT NULL,
`container_id` text NOT NULL,
`external_id` text NOT NULL,
`app_id` text NOT NULL,
`board_id` text NOT NULL,
`item_id` text,
`integration_id` text,
`updated_at` integer NOT NULL,
PRIMARY KEY(`host`, `container_id`),
FOREIGN KEY (`app_id`) REFERENCES `app`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`board_id`) REFERENCES `board`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`item_id`) REFERENCES `item`(`id`) ON UPDATE no action ON DELETE set null,
FOREIGN KEY (`integration_id`) REFERENCES `integration`(`id`) ON UPDATE no action ON DELETE set null
);
--> statement-breakpoint
CREATE INDEX `docker_app_source__external_id_idx` ON `docker_app_source` (`host`,`external_id`);
@@ -1,7 +1,7 @@
{
"version": "6",
"dialect": "sqlite",
"id": "fd156df1-3378-4d8b-924a-2bb548f8b3a8",
"id": "f30b6535-b4d5-4501-8370-7a7605e28bbd",
"prevId": "ddg-bangs-sqlite-0036",
"tables": {
"account": {
@@ -88,9 +88,7 @@
"indexes": {
"userId_idx": {
"name": "userId_idx",
"columns": [
"user_id"
],
"columns": ["user_id"],
"isUnique": false
}
},
@@ -99,22 +97,15 @@
"name": "account_user_id_user_id_fk",
"tableFrom": "account",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"account_provider_provider_account_id_pk": {
"columns": [
"provider",
"provider_account_id"
],
"columns": ["provider", "provider_account_id"],
"name": "account_provider_provider_account_id_pk"
}
},
@@ -152,12 +143,8 @@
"name": "apiKey_user_id_user_id_fk",
"tableFrom": "apiKey",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -249,12 +236,8 @@
"name": "boardGroupPermission_board_id_board_id_fk",
"tableFrom": "boardGroupPermission",
"tableTo": "board",
"columnsFrom": [
"board_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["board_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -262,23 +245,15 @@
"name": "boardGroupPermission_group_id_group_id_fk",
"tableFrom": "boardGroupPermission",
"tableTo": "group",
"columnsFrom": [
"group_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["group_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"boardGroupPermission_board_id_group_id_permission_pk": {
"columns": [
"board_id",
"group_id",
"permission"
],
"columns": ["board_id", "group_id", "permission"],
"name": "boardGroupPermission_board_id_group_id_permission_pk"
}
},
@@ -316,12 +291,8 @@
"name": "boardUserPermission_board_id_board_id_fk",
"tableFrom": "boardUserPermission",
"tableTo": "board",
"columnsFrom": [
"board_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["board_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -329,23 +300,15 @@
"name": "boardUserPermission_user_id_user_id_fk",
"tableFrom": "boardUserPermission",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"boardUserPermission_board_id_user_id_permission_pk": {
"columns": [
"board_id",
"user_id",
"permission"
],
"columns": ["board_id", "user_id", "permission"],
"name": "boardUserPermission_board_id_user_id_permission_pk"
}
},
@@ -501,9 +464,7 @@
"indexes": {
"board_name_unique": {
"name": "board_name_unique",
"columns": [
"name"
],
"columns": ["name"],
"isUnique": true
}
},
@@ -512,12 +473,8 @@
"name": "board_creator_id_user_id_fk",
"tableFrom": "board",
"tableTo": "user",
"columnsFrom": [
"creator_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["creator_id"],
"columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
}
@@ -558,142 +515,6 @@
"uniqueConstraints": {},
"checkConstraints": {}
},
"docker_app_source": {
"name": "docker_app_source",
"columns": {
"host": {
"name": "host",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"container_id": {
"name": "container_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"external_id": {
"name": "external_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"app_id": {
"name": "app_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"board_id": {
"name": "board_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"item_id": {
"name": "item_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"integration_id": {
"name": "integration_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {
"docker_app_source__external_id_idx": {
"name": "docker_app_source__external_id_idx",
"columns": [
"host",
"external_id"
],
"isUnique": false
}
},
"foreignKeys": {
"docker_app_source_app_id_app_id_fk": {
"name": "docker_app_source_app_id_app_id_fk",
"tableFrom": "docker_app_source",
"tableTo": "app",
"columnsFrom": [
"app_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"docker_app_source_board_id_board_id_fk": {
"name": "docker_app_source_board_id_board_id_fk",
"tableFrom": "docker_app_source",
"tableTo": "board",
"columnsFrom": [
"board_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"docker_app_source_item_id_item_id_fk": {
"name": "docker_app_source_item_id_item_id_fk",
"tableFrom": "docker_app_source",
"tableTo": "item",
"columnsFrom": [
"item_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
},
"docker_app_source_integration_id_integration_id_fk": {
"name": "docker_app_source_integration_id_integration_id_fk",
"tableFrom": "docker_app_source",
"tableTo": "integration",
"columnsFrom": [
"integration_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"docker_app_source_host_container_id_pk": {
"columns": [
"host",
"container_id"
],
"name": "docker_app_source_host_container_id_pk"
}
},
"uniqueConstraints": {},
"checkConstraints": {}
},
"groupMember": {
"name": "groupMember",
"columns": {
@@ -718,12 +539,8 @@
"name": "groupMember_group_id_group_id_fk",
"tableFrom": "groupMember",
"tableTo": "group",
"columnsFrom": [
"group_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["group_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -731,22 +548,15 @@
"name": "groupMember_user_id_user_id_fk",
"tableFrom": "groupMember",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"groupMember_group_id_user_id_pk": {
"columns": [
"group_id",
"user_id"
],
"columns": ["group_id", "user_id"],
"name": "groupMember_group_id_user_id_pk"
}
},
@@ -777,12 +587,8 @@
"name": "groupPermission_group_id_group_id_fk",
"tableFrom": "groupPermission",
"tableTo": "group",
"columnsFrom": [
"group_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["group_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -840,9 +646,7 @@
"indexes": {
"group_name_unique": {
"name": "group_name_unique",
"columns": [
"name"
],
"columns": ["name"],
"isUnique": true
}
},
@@ -851,12 +655,8 @@
"name": "group_owner_id_user_id_fk",
"tableFrom": "group",
"tableTo": "user",
"columnsFrom": [
"owner_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["owner_id"],
"columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
},
@@ -864,12 +664,8 @@
"name": "group_home_board_id_board_id_fk",
"tableFrom": "group",
"tableTo": "board",
"columnsFrom": [
"home_board_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["home_board_id"],
"columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
},
@@ -877,12 +673,8 @@
"name": "group_mobile_home_board_id_board_id_fk",
"tableFrom": "group",
"tableTo": "board",
"columnsFrom": [
"mobile_home_board_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["mobile_home_board_id"],
"columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
}
@@ -960,12 +752,8 @@
"name": "icon_icon_repository_id_iconRepository_id_fk",
"tableFrom": "icon",
"tableTo": "iconRepository",
"columnsFrom": [
"icon_repository_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["icon_repository_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -1005,12 +793,8 @@
"name": "integrationGroupPermissions_integration_id_integration_id_fk",
"tableFrom": "integrationGroupPermissions",
"tableTo": "integration",
"columnsFrom": [
"integration_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["integration_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -1018,23 +802,15 @@
"name": "integrationGroupPermissions_group_id_group_id_fk",
"tableFrom": "integrationGroupPermissions",
"tableTo": "group",
"columnsFrom": [
"group_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["group_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"integrationGroupPermissions_integration_id_group_id_permission_pk": {
"columns": [
"integration_id",
"group_id",
"permission"
],
"columns": ["integration_id", "group_id", "permission"],
"name": "integrationGroupPermissions_integration_id_group_id_permission_pk"
}
},
@@ -1065,12 +841,8 @@
"name": "integration_item_item_id_item_id_fk",
"tableFrom": "integration_item",
"tableTo": "item",
"columnsFrom": [
"item_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["item_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -1078,22 +850,15 @@
"name": "integration_item_integration_id_integration_id_fk",
"tableFrom": "integration_item",
"tableTo": "integration",
"columnsFrom": [
"integration_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["integration_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"integration_item_item_id_integration_id_pk": {
"columns": [
"item_id",
"integration_id"
],
"columns": ["item_id", "integration_id"],
"name": "integration_item_item_id_integration_id_pk"
}
},
@@ -1135,16 +900,12 @@
"indexes": {
"integration_secret__kind_idx": {
"name": "integration_secret__kind_idx",
"columns": [
"kind"
],
"columns": ["kind"],
"isUnique": false
},
"integration_secret__updated_at_idx": {
"name": "integration_secret__updated_at_idx",
"columns": [
"updated_at"
],
"columns": ["updated_at"],
"isUnique": false
}
},
@@ -1153,22 +914,15 @@
"name": "integrationSecret_integration_id_integration_id_fk",
"tableFrom": "integrationSecret",
"tableTo": "integration",
"columnsFrom": [
"integration_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["integration_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"integrationSecret_integration_id_kind_pk": {
"columns": [
"integration_id",
"kind"
],
"columns": ["integration_id", "kind"],
"name": "integrationSecret_integration_id_kind_pk"
}
},
@@ -1206,12 +960,8 @@
"name": "integrationUserPermission_integration_id_integration_id_fk",
"tableFrom": "integrationUserPermission",
"tableTo": "integration",
"columnsFrom": [
"integration_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["integration_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -1219,23 +969,15 @@
"name": "integrationUserPermission_user_id_user_id_fk",
"tableFrom": "integrationUserPermission",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"integrationUserPermission_integration_id_user_id_permission_pk": {
"columns": [
"integration_id",
"user_id",
"permission"
],
"columns": ["integration_id", "user_id", "permission"],
"name": "integrationUserPermission_integration_id_user_id_permission_pk"
}
},
@@ -1284,9 +1026,7 @@
"indexes": {
"integration__kind_idx": {
"name": "integration__kind_idx",
"columns": [
"kind"
],
"columns": ["kind"],
"isUnique": false
}
},
@@ -1295,12 +1035,8 @@
"name": "integration_app_id_app_id_fk",
"tableFrom": "integration",
"tableTo": "app",
"columnsFrom": [
"app_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["app_id"],
"columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
}
@@ -1344,9 +1080,7 @@
"indexes": {
"invite_token_unique": {
"name": "invite_token_unique",
"columns": [
"token"
],
"columns": ["token"],
"isUnique": true
}
},
@@ -1355,12 +1089,8 @@
"name": "invite_creator_id_user_id_fk",
"tableFrom": "invite",
"tableTo": "user",
"columnsFrom": [
"creator_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["creator_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -1428,12 +1158,8 @@
"name": "item_layout_item_id_item_id_fk",
"tableFrom": "item_layout",
"tableTo": "item",
"columnsFrom": [
"item_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["item_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -1441,12 +1167,8 @@
"name": "item_layout_section_id_section_id_fk",
"tableFrom": "item_layout",
"tableTo": "section",
"columnsFrom": [
"section_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["section_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -1454,23 +1176,15 @@
"name": "item_layout_layout_id_layout_id_fk",
"tableFrom": "item_layout",
"tableTo": "layout",
"columnsFrom": [
"layout_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["layout_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"item_layout_item_id_section_id_layout_id_pk": {
"columns": [
"item_id",
"section_id",
"layout_id"
],
"columns": ["item_id", "section_id", "layout_id"],
"name": "item_layout_item_id_section_id_layout_id_pk"
}
},
@@ -1524,12 +1238,8 @@
"name": "item_board_id_board_id_fk",
"tableFrom": "item",
"tableTo": "board",
"columnsFrom": [
"board_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["board_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -1584,12 +1294,8 @@
"name": "layout_board_id_board_id_fk",
"tableFrom": "layout",
"tableTo": "board",
"columnsFrom": [
"board_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["board_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -1658,12 +1364,8 @@
"name": "media_creator_id_user_id_fk",
"tableFrom": "media",
"tableTo": "user",
"columnsFrom": [
"creator_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["creator_id"],
"columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
}
@@ -1767,9 +1469,7 @@
"indexes": {
"search_engine_short_unique": {
"name": "search_engine_short_unique",
"columns": [
"short"
],
"columns": ["short"],
"isUnique": true
}
},
@@ -1778,12 +1478,8 @@
"name": "search_engine_integration_id_integration_id_fk",
"tableFrom": "search_engine",
"tableTo": "integration",
"columnsFrom": [
"integration_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["integration_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -1824,12 +1520,8 @@
"name": "section_collapse_state_user_id_user_id_fk",
"tableFrom": "section_collapse_state",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -1837,22 +1529,15 @@
"name": "section_collapse_state_section_id_section_id_fk",
"tableFrom": "section_collapse_state",
"tableTo": "section",
"columnsFrom": [
"section_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["section_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"section_collapse_state_user_id_section_id_pk": {
"columns": [
"user_id",
"section_id"
],
"columns": ["user_id", "section_id"],
"name": "section_collapse_state_user_id_section_id_pk"
}
},
@@ -1918,12 +1603,8 @@
"name": "section_layout_section_id_section_id_fk",
"tableFrom": "section_layout",
"tableTo": "section",
"columnsFrom": [
"section_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["section_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -1931,12 +1612,8 @@
"name": "section_layout_layout_id_layout_id_fk",
"tableFrom": "section_layout",
"tableTo": "layout",
"columnsFrom": [
"layout_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["layout_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
},
@@ -1944,22 +1621,15 @@
"name": "section_layout_parent_section_id_section_id_fk",
"tableFrom": "section_layout",
"tableTo": "section",
"columnsFrom": [
"parent_section_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["parent_section_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"section_layout_section_id_layout_id_pk": {
"columns": [
"section_id",
"layout_id"
],
"columns": ["section_id", "layout_id"],
"name": "section_layout_section_id_layout_id_pk"
}
},
@@ -2026,12 +1696,8 @@
"name": "section_board_id_board_id_fk",
"tableFrom": "section",
"tableTo": "board",
"columnsFrom": [
"board_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["board_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -2062,9 +1728,7 @@
"indexes": {
"serverSetting_settingKey_unique": {
"name": "serverSetting_settingKey_unique",
"columns": [
"setting_key"
],
"columns": ["setting_key"],
"isUnique": true
}
},
@@ -2101,9 +1765,7 @@
"indexes": {
"user_id_idx": {
"name": "user_id_idx",
"columns": [
"user_id"
],
"columns": ["user_id"],
"isUnique": false
}
},
@@ -2112,12 +1774,8 @@
"name": "session_user_id_user_id_fk",
"tableFrom": "session",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["user_id"],
"columnsTo": ["id"],
"onDelete": "cascade",
"onUpdate": "no action"
}
@@ -2155,10 +1813,7 @@
"foreignKeys": {},
"compositePrimaryKeys": {
"trusted_certificate_hostname_hostname_thumbprint_pk": {
"columns": [
"hostname",
"thumbprint"
],
"columns": ["hostname", "thumbprint"],
"name": "trusted_certificate_hostname_hostname_thumbprint_pk"
}
},
@@ -2278,6 +1933,22 @@
"notNull": true,
"autoincrement": false,
"default": false
},
"completed_manage_tour": {
"name": "completed_manage_tour",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": false
},
"completed_board_tour": {
"name": "completed_board_tour",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": false
}
},
"indexes": {},
@@ -2286,12 +1957,8 @@
"name": "user_home_board_id_board_id_fk",
"tableFrom": "user",
"tableTo": "board",
"columnsFrom": [
"home_board_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["home_board_id"],
"columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
},
@@ -2299,12 +1966,8 @@
"name": "user_mobile_home_board_id_board_id_fk",
"tableFrom": "user",
"tableTo": "board",
"columnsFrom": [
"mobile_home_board_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["mobile_home_board_id"],
"columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
},
@@ -2312,12 +1975,8 @@
"name": "user_default_search_engine_id_search_engine_id_fk",
"tableFrom": "user",
"tableTo": "search_engine",
"columnsFrom": [
"default_search_engine_id"
],
"columnsTo": [
"id"
],
"columnsFrom": ["default_search_engine_id"],
"columnsTo": ["id"],
"onDelete": "set null",
"onUpdate": "no action"
}
@@ -2355,10 +2014,7 @@
"foreignKeys": {},
"compositePrimaryKeys": {
"verificationToken_identifier_token_pk": {
"columns": [
"identifier",
"token"
],
"columns": ["identifier", "token"],
"name": "verificationToken_identifier_token_pk"
}
},
@@ -2376,4 +2032,4 @@
"internal": {
"indexes": {}
}
}
}
File diff suppressed because it is too large. Load diff
@@ -264,8 +264,15 @@
{
"idx": 37,
"version": "6",
"when": 1779199046805,
"tag": "0037_add_user_onboarding_tour_status",
"breakpoints": true
},
{
"idx": 38,
"version": "6",
"when": 1780490686287,
"tag": "0037_add_docker_app_source",
"tag": "0038_add_docker_app_source",
"breakpoints": true
}
]
+1
View File
@@ -1,3 +1,4 @@
export * from "./item";
export * from "./server-setting";
export * from "./group";
export * from "./widget-placement";
+148
View File
@@ -0,0 +1,148 @@
import superjson from "superjson";
import { createId } from "@homarr/common";
import {
defaultBookmarkApps,
defaultWidgetConfigs,
emptySuperJSON,
getWidgetKindsForIntegration,
} from "@homarr/definitions";
import type { WidgetKind } from "@homarr/definitions";
import type { Database } from "..";
import { integrationItems, itemLayouts, items } from "../schema";
import type { Integration } from "../schema";
const widgetConfigMap = new Map(defaultWidgetConfigs.map((config) => [config.kind, config]));
interface BoardTarget {
boardId: string;
sectionId: string;
layoutId: string;
columnCount: number;
}
interface PlacementContext extends BoardTarget {
xOffset: number;
yOffset: number;
rowMaxHeight: number;
}
const placeWidgetAsync = async (
db: Database,
ctx: PlacementContext,
kind: WidgetKind,
linkedIntegrationIds: string[],
options?: string,
size?: { width: number; height: number },
) => {
const itemWidth = size?.width ?? 2;
const itemHeight = size?.height ?? 2;
if (ctx.xOffset + itemWidth > ctx.columnCount) {
ctx.xOffset = 0;
ctx.yOffset += ctx.rowMaxHeight;
ctx.rowMaxHeight = 0;
}
const itemId = createId();
await db.insert(items).values({
id: itemId,
boardId: ctx.boardId,
kind,
options: options ?? emptySuperJSON,
advancedOptions: emptySuperJSON,
});
await db.insert(itemLayouts).values({
itemId,
sectionId: ctx.sectionId,
layoutId: ctx.layoutId,
xOffset: ctx.xOffset,
yOffset: ctx.yOffset,
width: itemWidth,
height: itemHeight,
});
for (const integrationId of linkedIntegrationIds) {
await db.insert(integrationItems).values({ itemId, integrationId });
}
ctx.rowMaxHeight = Math.max(ctx.rowMaxHeight, itemHeight);
ctx.xOffset += itemWidth;
};
interface App {
id: string;
name: string;
}
export const placeAllWidgetsAsync = async (
db: Database,
target: BoardTarget,
allIntegrations: Integration[],
allApps: App[],
) => {
const ctx: PlacementContext = {
...target,
xOffset: 0,
yOffset: 0,
rowMaxHeight: 0,
};
const placedWidgets = new Set<WidgetKind>();
for (const integration of allIntegrations) {
for (const widgetKind of getWidgetKindsForIntegration(integration.kind)) {
if (placedWidgets.has(widgetKind)) continue;
const config = widgetConfigMap.get(widgetKind);
if (config?.skip) continue;
placedWidgets.add(widgetKind);
const matchingIds = allIntegrations
.filter((row) => getWidgetKindsForIntegration(row.kind).includes(widgetKind))
.map((row) => row.id);
const options = config?.options ? superjson.stringify(config.options) : undefined;
await placeWidgetAsync(
db,
ctx,
widgetKind,
matchingIds,
options,
config && { width: config.width, height: config.height },
);
}
}
for (const app of allApps) {
await placeWidgetAsync(
db,
ctx,
"app",
[],
superjson.stringify({ appId: app.id, openInNewTab: true, showTitle: true }),
{ width: 1, height: 1 },
);
}
const bookmarkAppNames = new Set(defaultBookmarkApps.map((bookmark) => bookmark.name));
const bookmarkAppIds = allApps.filter((app) => bookmarkAppNames.has(app.name)).map((app) => app.id);
for (const config of defaultWidgetConfigs) {
if (config.skip || placedWidgets.has(config.kind)) continue;
placedWidgets.add(config.kind);
let options = config.options ? { ...config.options } : undefined;
if (config.kind === "bookmarks" && bookmarkAppIds.length > 0) {
options = { ...options, items: bookmarkAppIds };
}
await placeWidgetAsync(db, ctx, config.kind, [], options ? superjson.stringify(options) : undefined, {
width: config.width,
height: config.height,
});
}
return placedWidgets.size + allApps.length;
};
+2
View File
@@ -80,6 +80,8 @@ export const users = mysqlTable("user", {
colorScheme: varchar({ length: 5 }).$type<ColorScheme>().default("dark").notNull(),
firstDayOfWeek: tinyint().$type<DayOfWeek>().default(1).notNull(), // Defaults to Monday
pingIconsEnabled: boolean().default(false).notNull(),
completedManageTour: boolean().default(false).notNull(),
completedBoardTour: boolean().default(false).notNull(),
});
export const accounts = mysqlTable(
+2
View File
@@ -79,6 +79,8 @@ export const users = pgTable("user", {
colorScheme: varchar({ length: 5 }).$type<ColorScheme>().default("dark").notNull(),
firstDayOfWeek: smallint().$type<DayOfWeek>().default(1).notNull(), // Defaults to Monday
pingIconsEnabled: boolean().default(false).notNull(),
completedManageTour: boolean().default(false).notNull(),
completedBoardTour: boolean().default(false).notNull(),
});
export const accounts = pgTable(
+2
View File
@@ -62,6 +62,8 @@ export const users = sqliteTable("user", {
colorScheme: text().$type<ColorScheme>().default("dark").notNull(),
firstDayOfWeek: int().$type<DayOfWeek>().default(1).notNull(), // Defaults to Monday
pingIconsEnabled: int({ mode: "boolean" }).default(false).notNull(),
completedManageTour: int({ mode: "boolean" }).default(false).notNull(),
completedBoardTour: int({ mode: "boolean" }).default(false).notNull(),
});
export const accounts = sqliteTable(