Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

refactor: make casing for column names consistent (#1517)

Meier Lukas8fea983c2e89
diff --git a/packages/db/configs/mysql.config.ts b/packages/db/configs/mysql.config.ts
index 407fae864..95d0ab936 100644
--- a/packages/db/configs/mysql.config.ts
+++ b/packages/db/configs/mysql.config.ts
@@ -7,6 +7,7 @@ dotenv.config({ path: "../../.env" });
export default {
dialect: "mysql",
schema: "./schema",
+ casing: "snake_case",
dbCredentials: {
host: process.env.DB_HOST!,
user: process.env.DB_USER!,
diff --git a/packages/db/configs/sqlite.config.ts b/packages/db/configs/sqlite.config.ts
index aba34fe26..8e71be989 100644
--- a/packages/db/configs/sqlite.config.ts
+++ b/packages/db/configs/sqlite.config.ts
@@ -6,6 +6,7 @@ dotenv.config({ path: "../../.env" });
export default {
dialect: "sqlite",
schema: "./schema",
+ casing: "snake_case",
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
dbCredentials: { url: process.env.DB_URL! },
out: "./migrations/sqlite",
diff --git a/packages/db/driver.ts b/packages/db/driver.ts
index 36a86ece5..9eac1531d 100644
--- a/packages/db/driver.ts
+++ b/packages/db/driver.ts
@@ -40,6 +40,7 @@ const initBetterSqlite = () => {
database = drizzleSqlite(connection, {
schema: sqliteSchema,
logger: new WinstonDrizzleLogger(),
+ casing: "snake_case",
}) as unknown as never;
};
@@ -61,6 +62,7 @@ const initMySQL2 = () => {
schema: mysqlSchema,
mode: "default",
logger: new WinstonDrizzleLogger(),
+ casing: "snake_case",
}) as unknown as HomarrDatabase;
};
diff --git a/packages/db/migrations/mysql/0016_change_all_to_snake_case.sql b/packages/db/migrations/mysql/0016_change_all_to_snake_case.sql
new file mode 100644
index 000000000..799b14fb6
--- /dev/null
+++ b/packages/db/migrations/mysql/0016_change_all_to_snake_case.sql
@@ -0,0 +1,64 @@
+ALTER TABLE `account` RENAME COLUMN `userId` TO `user_id`;--> statement-breakpoint
+ALTER TABLE `account` RENAME COLUMN `providerAccountId` TO `provider_account_id`;--> statement-breakpoint
+ALTER TABLE `apiKey` RENAME COLUMN `apiKey` TO `api_key`;--> statement-breakpoint
+ALTER TABLE `apiKey` RENAME COLUMN `userId` TO `user_id`;--> statement-breakpoint
+ALTER TABLE `groupMember` RENAME COLUMN `groupId` TO `group_id`;--> statement-breakpoint
+ALTER TABLE `groupMember` RENAME COLUMN `userId` TO `user_id`;--> statement-breakpoint
+ALTER TABLE `groupPermission` RENAME COLUMN `groupId` TO `group_id`;--> statement-breakpoint
+ALTER TABLE `iconRepository` RENAME COLUMN `iconRepository_id` TO `id`;--> statement-breakpoint
+ALTER TABLE `iconRepository` RENAME COLUMN `iconRepository_slug` TO `slug`;--> statement-breakpoint
+ALTER TABLE `icon` RENAME COLUMN `icon_id` TO `id`;--> statement-breakpoint
+ALTER TABLE `icon` RENAME COLUMN `icon_name` TO `name`;--> statement-breakpoint
+ALTER TABLE `icon` RENAME COLUMN `icon_url` TO `url`;--> statement-breakpoint
+ALTER TABLE `icon` RENAME COLUMN `icon_checksum` TO `checksum`;--> statement-breakpoint
+ALTER TABLE `icon` RENAME COLUMN `iconRepository_id` TO `icon_repository_id`;--> statement-breakpoint
+ALTER TABLE `serverSetting` RENAME COLUMN `key` TO `setting_key`;--> statement-breakpoint
+ALTER TABLE `session` RENAME COLUMN `sessionToken` TO `session_token`;--> statement-breakpoint
+ALTER TABLE `session` RENAME COLUMN `userId` TO `user_id`;--> statement-breakpoint
+ALTER TABLE `user` RENAME COLUMN `emailVerified` TO `email_verified`;--> statement-breakpoint
+ALTER TABLE `user` RENAME COLUMN `homeBoardId` TO `home_board_id`;--> statement-breakpoint
+ALTER TABLE `user` RENAME COLUMN `colorScheme` TO `color_scheme`;--> statement-breakpoint
+ALTER TABLE `user` RENAME COLUMN `firstDayOfWeek` TO `first_day_of_week`;--> statement-breakpoint
+ALTER TABLE `user` RENAME COLUMN `pingIconsEnabled` TO `ping_icons_enabled`;--> statement-breakpoint
+ALTER TABLE `serverSetting` DROP INDEX `serverSetting_key_unique`;--> statement-breakpoint
+ALTER TABLE `account` DROP FOREIGN KEY `account_userId_user_id_fk`;
+--> statement-breakpoint
+ALTER TABLE `apiKey` DROP FOREIGN KEY `apiKey_userId_user_id_fk`;
+--> statement-breakpoint
+ALTER TABLE `groupMember` DROP FOREIGN KEY `groupMember_groupId_group_id_fk`;
+--> statement-breakpoint
+ALTER TABLE `groupMember` DROP FOREIGN KEY `groupMember_userId_user_id_fk`;
+--> statement-breakpoint
+ALTER TABLE `groupPermission` DROP FOREIGN KEY `groupPermission_groupId_group_id_fk`;
+--> statement-breakpoint
+ALTER TABLE `icon` DROP FOREIGN KEY `icon_iconRepository_id_iconRepository_iconRepository_id_fk`;
+--> statement-breakpoint
+ALTER TABLE `session` DROP FOREIGN KEY `session_userId_user_id_fk`;
+--> statement-breakpoint
+ALTER TABLE `user` DROP FOREIGN KEY `user_homeBoardId_board_id_fk`;
+--> statement-breakpoint
+DROP INDEX `userId_idx` ON `account`;--> statement-breakpoint
+DROP INDEX `user_id_idx` ON `session`;--> statement-breakpoint
+ALTER TABLE `account` DROP PRIMARY KEY;--> statement-breakpoint
+ALTER TABLE `groupMember` DROP PRIMARY KEY;--> statement-breakpoint
+ALTER TABLE `iconRepository` DROP PRIMARY KEY;--> statement-breakpoint
+ALTER TABLE `icon` DROP PRIMARY KEY;--> statement-breakpoint
+ALTER TABLE `serverSetting` DROP PRIMARY KEY;--> statement-breakpoint
+ALTER TABLE `session` DROP PRIMARY KEY;--> statement-breakpoint
+ALTER TABLE `account` ADD PRIMARY KEY(`provider`,`provider_account_id`);--> statement-breakpoint
+ALTER TABLE `groupMember` ADD PRIMARY KEY(`group_id`,`user_id`);--> statement-breakpoint
+ALTER TABLE `iconRepository` ADD PRIMARY KEY(`id`);--> statement-breakpoint
+ALTER TABLE `icon` ADD PRIMARY KEY(`id`);--> statement-breakpoint
+ALTER TABLE `serverSetting` ADD PRIMARY KEY(`setting_key`);--> statement-breakpoint
+ALTER TABLE `session` ADD PRIMARY KEY(`session_token`);--> statement-breakpoint
+ALTER TABLE `serverSetting` ADD CONSTRAINT `serverSetting_settingKey_unique` UNIQUE(`setting_key`);--> statement-breakpoint
+ALTER TABLE `account` ADD CONSTRAINT `account_user_id_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
+ALTER TABLE `apiKey` ADD CONSTRAINT `apiKey_user_id_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
+ALTER TABLE `groupMember` ADD CONSTRAINT `groupMember_group_id_group_id_fk` FOREIGN KEY (`group_id`) REFERENCES `group`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
+ALTER TABLE `groupMember` ADD CONSTRAINT `groupMember_user_id_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
+ALTER TABLE `groupPermission` ADD CONSTRAINT `groupPermission_group_id_group_id_fk` FOREIGN KEY (`group_id`) REFERENCES `group`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
+ALTER TABLE `icon` ADD CONSTRAINT `icon_icon_repository_id_iconRepository_id_fk` FOREIGN KEY (`icon_repository_id`) REFERENCES `iconRepository`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
+ALTER TABLE `session` ADD CONSTRAINT `session_user_id_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
+ALTER TABLE `user` ADD CONSTRAINT `user_home_board_id_board_id_fk` FOREIGN KEY (`home_board_id`) REFERENCES `board`(`id`) ON DELETE set null ON UPDATE no action;--> statement-breakpoint
+CREATE INDEX `userId_idx` ON `account` (`user_id`);--> statement-breakpoint
+CREATE INDEX `user_id_idx` ON `session` (`user_id`);
\ No newline at end of file
diff --git a/packages/db/migrations/mysql/meta/0016_snapshot.json b/packages/db/migrations/mysql/meta/0016_snapshot.json
new file mode 100644
index 000000000..a9399b358
--- /dev/null
+++ b/packages/db/migrations/mysql/meta/0016_snapshot.json
@@ -0,0 +1,1650 @@
+{
+ "version": "5",
+ "dialect": "mysql",
+ "id": "50b295e1-1802-477c-9ee1-b2cad1e9f5bb",
+ "prevId": "1bffd9d6-3a7b-42c4-a9e9-618a1b4ca9bc",
+ "tables": {
+ "account": {
+ "name": "account",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider_account_id": {
+ "name": "provider_account_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "token_type": {
+ "name": "token_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "session_state": {
+ "name": "session_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "userId_idx": {
+ "name": "userId_idx",
+ "columns": ["user_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "account_user_id_user_id_fk": {
+ "name": "account_user_id_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "account_provider_provider_account_id_pk": {
+ "name": "account_provider_provider_account_id_pk",
+ "columns": ["provider", "provider_account_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "apiKey": {
+ "name": "apiKey",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "api_key": {
+ "name": "api_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "salt": {
+ "name": "salt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "apiKey_user_id_user_id_fk": {
+ "name": "apiKey_user_id_user_id_fk",
+ "tableFrom": "apiKey",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "apiKey_id": {
+ "name": "apiKey_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "app": {
+ "name": "app",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "icon_url": {
+ "name": "icon_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "href": {
+ "name": "href",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "app_id": {
+ "name": "app_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "boardGroupPermission": {
+ "name": "boardGroupPermission",
+ "columns": {
+ "board_id": {
+ "name": "board_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "permission": {
+ "name": "permission",
+ "type": "varchar(128)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "boardGroupPermission_board_id_board_id_fk": {
+ "name": "boardGroupPermission_board_id_board_id_fk",
+ "tableFrom": "boardGroupPermission",
+ "tableTo": "board",
+ "columnsFrom": ["board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "boardGroupPermission_group_id_group_id_fk": {
+ "name": "boardGroupPermission_group_id_group_id_fk",
+ "tableFrom": "boardGroupPermission",
+ "tableTo": "group",
+ "columnsFrom": ["group_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "boardGroupPermission_board_id_group_id_permission_pk": {
+ "name": "boardGroupPermission_board_id_group_id_permission_pk",
+ "columns": ["board_id", "group_id", "permission"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "boardUserPermission": {
+ "name": "boardUserPermission",
+ "columns": {
+ "board_id": {
+ "name": "board_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "permission": {
+ "name": "permission",
+ "type": "varchar(128)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "boardUserPermission_board_id_board_id_fk": {
+ "name": "boardUserPermission_board_id_board_id_fk",
+ "tableFrom": "boardUserPermission",
+ "tableTo": "board",
+ "columnsFrom": ["board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "boardUserPermission_user_id_user_id_fk": {
+ "name": "boardUserPermission_user_id_user_id_fk",
+ "tableFrom": "boardUserPermission",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "boardUserPermission_board_id_user_id_permission_pk": {
+ "name": "boardUserPermission_board_id_user_id_permission_pk",
+ "columns": ["board_id", "user_id", "permission"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "board": {
+ "name": "board",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_public": {
+ "name": "is_public",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "creator_id": {
+ "name": "creator_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "page_title": {
+ "name": "page_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "meta_title": {
+ "name": "meta_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "logo_image_url": {
+ "name": "logo_image_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "favicon_image_url": {
+ "name": "favicon_image_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "background_image_url": {
+ "name": "background_image_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "background_image_attachment": {
+ "name": "background_image_attachment",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "('fixed')"
+ },
+ "background_image_repeat": {
+ "name": "background_image_repeat",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "('no-repeat')"
+ },
+ "background_image_size": {
+ "name": "background_image_size",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "('cover')"
+ },
+ "primary_color": {
+ "name": "primary_color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "('#fa5252')"
+ },
+ "secondary_color": {
+ "name": "secondary_color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "('#fd7e14')"
+ },
+ "opacity": {
+ "name": "opacity",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 100
+ },
+ "custom_css": {
+ "name": "custom_css",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "column_count": {
+ "name": "column_count",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 10
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "board_creator_id_user_id_fk": {
+ "name": "board_creator_id_user_id_fk",
+ "tableFrom": "board",
+ "tableTo": "user",
+ "columnsFrom": ["creator_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "board_id": {
+ "name": "board_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {
+ "board_name_unique": {
+ "name": "board_name_unique",
+ "columns": ["name"]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "groupMember": {
+ "name": "groupMember",
+ "columns": {
+ "group_id": {
+ "name": "group_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "groupMember_group_id_group_id_fk": {
+ "name": "groupMember_group_id_group_id_fk",
+ "tableFrom": "groupMember",
+ "tableTo": "group",
+ "columnsFrom": ["group_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "groupMember_user_id_user_id_fk": {
+ "name": "groupMember_user_id_user_id_fk",
+ "tableFrom": "groupMember",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "groupMember_group_id_user_id_pk": {
+ "name": "groupMember_group_id_user_id_pk",
+ "columns": ["group_id", "user_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "groupPermission": {
+ "name": "groupPermission",
+ "columns": {
+ "group_id": {
+ "name": "group_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "permission": {
+ "name": "permission",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "groupPermission_group_id_group_id_fk": {
+ "name": "groupPermission_group_id_group_id_fk",
+ "tableFrom": "groupPermission",
+ "tableTo": "group",
+ "columnsFrom": ["group_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "group": {
+ "name": "group",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "group_owner_id_user_id_fk": {
+ "name": "group_owner_id_user_id_fk",
+ "tableFrom": "group",
+ "tableTo": "user",
+ "columnsFrom": ["owner_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "group_id": {
+ "name": "group_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {
+ "group_name_unique": {
+ "name": "group_name_unique",
+ "columns": ["name"]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "iconRepository": {
+ "name": "iconRepository",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "slug": {
+ "name": "slug",
+ "type": "varchar(150)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "iconRepository_id": {
+ "name": "iconRepository_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "icon": {
+ "name": "icon",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(250)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "checksum": {
+ "name": "checksum",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "icon_repository_id": {
+ "name": "icon_repository_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "icon_icon_repository_id_iconRepository_id_fk": {
+ "name": "icon_icon_repository_id_iconRepository_id_fk",
+ "tableFrom": "icon",
+ "tableTo": "iconRepository",
+ "columnsFrom": ["icon_repository_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "icon_id": {
+ "name": "icon_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "integrationGroupPermissions": {
+ "name": "integrationGroupPermissions",
+ "columns": {
+ "integration_id": {
+ "name": "integration_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "permission": {
+ "name": "permission",
+ "type": "varchar(128)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "integrationGroupPermissions_integration_id_integration_id_fk": {
+ "name": "integrationGroupPermissions_integration_id_integration_id_fk",
+ "tableFrom": "integrationGroupPermissions",
+ "tableTo": "integration",
+ "columnsFrom": ["integration_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "integrationGroupPermissions_group_id_group_id_fk": {
+ "name": "integrationGroupPermissions_group_id_group_id_fk",
+ "tableFrom": "integrationGroupPermissions",
+ "tableTo": "group",
+ "columnsFrom": ["group_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "integration_group_permission__pk": {
+ "name": "integration_group_permission__pk",
+ "columns": ["integration_id", "group_id", "permission"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "integration_item": {
+ "name": "integration_item",
+ "columns": {
+ "item_id": {
+ "name": "item_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "integration_id": {
+ "name": "integration_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "integration_item_item_id_item_id_fk": {
+ "name": "integration_item_item_id_item_id_fk",
+ "tableFrom": "integration_item",
+ "tableTo": "item",
+ "columnsFrom": ["item_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "integration_item_integration_id_integration_id_fk": {
+ "name": "integration_item_integration_id_integration_id_fk",
+ "tableFrom": "integration_item",
+ "tableTo": "integration",
+ "columnsFrom": ["integration_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "integration_item_item_id_integration_id_pk": {
+ "name": "integration_item_item_id_integration_id_pk",
+ "columns": ["item_id", "integration_id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "integrationSecret": {
+ "name": "integrationSecret",
+ "columns": {
+ "kind": {
+ "name": "kind",
+ "type": "varchar(16)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "integration_id": {
+ "name": "integration_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "integration_secret__kind_idx": {
+ "name": "integration_secret__kind_idx",
+ "columns": ["kind"],
+ "isUnique": false
+ },
+ "integration_secret__updated_at_idx": {
+ "name": "integration_secret__updated_at_idx",
+ "columns": ["updated_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "integrationSecret_integration_id_integration_id_fk": {
+ "name": "integrationSecret_integration_id_integration_id_fk",
+ "tableFrom": "integrationSecret",
+ "tableTo": "integration",
+ "columnsFrom": ["integration_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "integrationSecret_integration_id_kind_pk": {
+ "name": "integrationSecret_integration_id_kind_pk",
+ "columns": ["integration_id", "kind"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "integrationUserPermission": {
+ "name": "integrationUserPermission",
+ "columns": {
+ "integration_id": {
+ "name": "integration_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "permission": {
+ "name": "permission",
+ "type": "varchar(128)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "integrationUserPermission_integration_id_integration_id_fk": {
+ "name": "integrationUserPermission_integration_id_integration_id_fk",
+ "tableFrom": "integrationUserPermission",
+ "tableTo": "integration",
+ "columnsFrom": ["integration_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "integrationUserPermission_user_id_user_id_fk": {
+ "name": "integrationUserPermission_user_id_user_id_fk",
+ "tableFrom": "integrationUserPermission",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "integrationUserPermission_integration_id_user_id_permission_pk": {
+ "name": "integrationUserPermission_integration_id_user_id_permission_pk",
+ "columns": ["integration_id", "user_id", "permission"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "integration": {
+ "name": "integration",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "varchar(128)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "integration__kind_idx": {
+ "name": "integration__kind_idx",
+ "columns": ["kind"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "integration_id": {
+ "name": "integration_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "invite": {
+ "name": "invite",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "varchar(512)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expiration_date": {
+ "name": "expiration_date",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "creator_id": {
+ "name": "creator_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "invite_creator_id_user_id_fk": {
+ "name": "invite_creator_id_user_id_fk",
+ "tableFrom": "invite",
+ "tableTo": "user",
+ "columnsFrom": ["creator_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "invite_id": {
+ "name": "invite_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {
+ "invite_token_unique": {
+ "name": "invite_token_unique",
+ "columns": ["token"]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "item": {
+ "name": "item",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "section_id": {
+ "name": "section_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "x_offset": {
+ "name": "x_offset",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "y_offset": {
+ "name": "y_offset",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "width": {
+ "name": "width",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "height": {
+ "name": "height",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "options": {
+ "name": "options",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "('{\"json\": {}}')"
+ },
+ "advanced_options": {
+ "name": "advanced_options",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "('{\"json\": {}}')"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "item_section_id_section_id_fk": {
+ "name": "item_section_id_section_id_fk",
+ "tableFrom": "item",
+ "tableTo": "section",
+ "columnsFrom": ["section_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "item_id": {
+ "name": "item_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "media": {
+ "name": "media",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(512)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "BLOB",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content_type": {
+ "name": "content_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "size": {
+ "name": "size",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(now())"
+ },
+ "creator_id": {
+ "name": "creator_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "media_creator_id_user_id_fk": {
+ "name": "media_creator_id_user_id_fk",
+ "tableFrom": "media",
+ "tableTo": "user",
+ "columnsFrom": ["creator_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "media_id": {
+ "name": "media_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "search_engine": {
+ "name": "search_engine",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "icon_url": {
+ "name": "icon_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "short": {
+ "name": "short",
+ "type": "varchar(8)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "url_template": {
+ "name": "url_template",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'generic'"
+ },
+ "integration_id": {
+ "name": "integration_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "search_engine_integration_id_integration_id_fk": {
+ "name": "search_engine_integration_id_integration_id_fk",
+ "tableFrom": "search_engine",
+ "tableTo": "integration",
+ "columnsFrom": ["integration_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "search_engine_id": {
+ "name": "search_engine_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "section": {
+ "name": "section",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "board_id": {
+ "name": "board_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "x_offset": {
+ "name": "x_offset",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "y_offset": {
+ "name": "y_offset",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "width": {
+ "name": "width",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "height": {
+ "name": "height",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "parent_section_id": {
+ "name": "parent_section_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "section_board_id_board_id_fk": {
+ "name": "section_board_id_board_id_fk",
+ "tableFrom": "section",
+ "tableTo": "board",
+ "columnsFrom": ["board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "section_parent_section_id_section_id_fk": {
+ "name": "section_parent_section_id_section_id_fk",
+ "tableFrom": "section",
+ "tableTo": "section",
+ "columnsFrom": ["parent_section_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "section_id": {
+ "name": "section_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "serverSetting": {
+ "name": "serverSetting",
+ "columns": {
+ "setting_key": {
+ "name": "setting_key",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "('{\"json\": {}}')"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "serverSetting_setting_key": {
+ "name": "serverSetting_setting_key",
+ "columns": ["setting_key"]
+ }
+ },
+ "uniqueConstraints": {
+ "serverSetting_settingKey_unique": {
+ "name": "serverSetting_settingKey_unique",
+ "columns": ["setting_key"]
+ }
+ },
+ "checkConstraint": {}
+ },
+ "session": {
+ "name": "session",
+ "columns": {
+ "session_token": {
+ "name": "session_token",
+ "type": "varchar(512)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires": {
+ "name": "expires",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "user_id_idx": {
+ "name": "user_id_idx",
+ "columns": ["user_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "session_session_token": {
+ "name": "session_session_token",
+ "columns": ["session_token"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "user": {
+ "name": "user",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "salt": {
+ "name": "salt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'credentials'"
+ },
+ "home_board_id": {
+ "name": "home_board_id",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "color_scheme": {
+ "name": "color_scheme",
+ "type": "varchar(5)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'dark'"
+ },
+ "first_day_of_week": {
+ "name": "first_day_of_week",
+ "type": "tinyint",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "ping_icons_enabled": {
+ "name": "ping_icons_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_home_board_id_board_id_fk": {
+ "name": "user_home_board_id_board_id_fk",
+ "tableFrom": "user",
+ "tableTo": "board",
+ "columnsFrom": ["home_board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "user_id": {
+ "name": "user_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ },
+ "verificationToken": {
+ "name": "verificationToken",
+ "columns": {
+ "identifier": {
+ "name": "identifier",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "varchar(512)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires": {
+ "name": "expires",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "verificationToken_identifier_token_pk": {
+ "name": "verificationToken_identifier_token_pk",
+ "columns": ["identifier", "token"]
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraint": {}
+ }
+ },
+ "views": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {
+ "\"account\".\"userId\"": "\"account\".\"user_id\"",
+ "\"account\".\"providerAccountId\"": "\"account\".\"provider_account_id\"",
+ "\"apiKey\".\"apiKey\"": "\"apiKey\".\"api_key\"",
+ "\"apiKey\".\"userId\"": "\"apiKey\".\"user_id\"",
+ "\"groupMember\".\"groupId\"": "\"groupMember\".\"group_id\"",
+ "\"groupMember\".\"userId\"": "\"groupMember\".\"user_id\"",
+ "\"groupPermission\".\"groupId\"": "\"groupPermission\".\"group_id\"",
+ "\"iconRepository\".\"iconRepository_id\"": "\"iconRepository\".\"id\"",
+ "\"iconRepository\".\"iconRepository_slug\"": "\"iconRepository\".\"slug\"",
+ "\"icon\".\"icon_id\"": "\"icon\".\"id\"",
+ "\"icon\".\"icon_name\"": "\"icon\".\"name\"",
+ "\"icon\".\"icon_url\"": "\"icon\".\"url\"",
+ "\"icon\".\"icon_checksum\"": "\"icon\".\"checksum\"",
+ "\"icon\".\"iconRepository_id\"": "\"icon\".\"icon_repository_id\"",
+ "\"serverSetting\".\"key\"": "\"serverSetting\".\"setting_key\"",
+ "\"session\".\"sessionToken\"": "\"session\".\"session_token\"",
+ "\"session\".\"userId\"": "\"session\".\"user_id\"",
+ "\"user\".\"emailVerified\"": "\"user\".\"email_verified\"",
+ "\"user\".\"homeBoardId\"": "\"user\".\"home_board_id\"",
+ "\"user\".\"colorScheme\"": "\"user\".\"color_scheme\"",
+ "\"user\".\"firstDayOfWeek\"": "\"user\".\"first_day_of_week\"",
+ "\"user\".\"pingIconsEnabled\"": "\"user\".\"ping_icons_enabled\""
+ }
+ },
+ "internal": {
+ "tables": {},
+ "indexes": {}
+ }
+}
diff --git a/packages/db/migrations/mysql/meta/_journal.json b/packages/db/migrations/mysql/meta/_journal.json
index 7deab9fb2..d740783f1 100644
--- a/packages/db/migrations/mysql/meta/_journal.json
+++ b/packages/db/migrations/mysql/meta/_journal.json
@@ -113,6 +113,13 @@
"when": 1730653393442,
"tag": "0015_unknown_firedrake",
"breakpoints": true
+ },
+ {
+ "idx": 16,
+ "version": "5",
+ "when": 1732212709518,
+ "tag": "0016_change_all_to_snake_case",
+ "breakpoints": true
}
]
}
diff --git a/packages/db/migrations/mysql/migrate.ts b/packages/db/migrations/mysql/migrate.ts
index 7cb343ceb..61a2401f7 100644
--- a/packages/db/migrations/mysql/migrate.ts
+++ b/packages/db/migrations/mysql/migrate.ts
@@ -25,6 +25,7 @@ const migrateAsync = async () => {
const db = drizzle(mysql2, {
mode: "default",
schema: mysqlSchema,
+ casing: "snake_case",
});
await migrate(db, { migrationsFolder });
diff --git a/packages/db/migrations/sqlite/0016_change_all_to_snake_case.sql b/packages/db/migrations/sqlite/0016_change_all_to_snake_case.sql
new file mode 100644
index 000000000..ce539c032
--- /dev/null
+++ b/packages/db/migrations/sqlite/0016_change_all_to_snake_case.sql
@@ -0,0 +1,102 @@
+ALTER TABLE `iconRepository` RENAME COLUMN "iconRepository_id" TO "id";--> statement-breakpoint
+ALTER TABLE `iconRepository` RENAME COLUMN "iconRepository_slug" TO "slug";--> statement-breakpoint
+ALTER TABLE `serverSetting` RENAME COLUMN "key" TO "setting_key";--> statement-breakpoint
+PRAGMA foreign_keys=OFF;--> statement-breakpoint
+CREATE TABLE `__new_account` (
+ `user_id` text NOT NULL,
+ `type` text NOT NULL,
+ `provider` text NOT NULL,
+ `provider_account_id` text NOT NULL,
+ `refresh_token` text,
+ `access_token` text,
+ `expires_at` integer,
+ `token_type` text,
+ `scope` text,
+ `id_token` text,
+ `session_state` text,
+ PRIMARY KEY(`provider`, `provider_account_id`),
+ FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_account`("user_id", "type", "provider", "provider_account_id", "refresh_token", "access_token", "expires_at", "token_type", "scope", "id_token", "session_state") SELECT "userId", "type", "provider", "providerAccountId", "refresh_token", "access_token", "expires_at", "token_type", "scope", "id_token", "session_state" FROM `account`;--> statement-breakpoint
+DROP TABLE `account`;--> statement-breakpoint
+ALTER TABLE `__new_account` RENAME TO `account`;--> statement-breakpoint
+PRAGMA foreign_keys=ON;--> statement-breakpoint
+CREATE INDEX `userId_idx` ON `account` (`user_id`);--> statement-breakpoint
+PRAGMA foreign_keys=OFF;--> statement-breakpoint
+CREATE TABLE `__new_apiKey` (
+ `id` text PRIMARY KEY NOT NULL,
+ `api_key` text NOT NULL,
+ `salt` text NOT NULL,
+ `user_id` text NOT NULL,
+ FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_apiKey`("id", "api_key", "salt", "user_id") SELECT "id", "apiKey", "salt", "userId" FROM `apiKey`;--> statement-breakpoint
+DROP TABLE `apiKey`;--> statement-breakpoint
+ALTER TABLE `__new_apiKey` RENAME TO `apiKey`;--> statement-breakpoint
+CREATE TABLE `__new_groupMember` (
+ `group_id` text NOT NULL,
+ `user_id` text NOT NULL,
+ PRIMARY KEY(`group_id`, `user_id`),
+ FOREIGN KEY (`group_id`) REFERENCES `group`(`id`) ON UPDATE no action ON DELETE cascade,
+ FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_groupMember`("group_id", "user_id") SELECT "groupId", "userId" FROM `groupMember`;--> statement-breakpoint
+DROP TABLE `groupMember`;--> statement-breakpoint
+ALTER TABLE `__new_groupMember` RENAME TO `groupMember`;--> statement-breakpoint
+CREATE TABLE `__new_groupPermission` (
+ `group_id` text NOT NULL,
+ `permission` text NOT NULL,
+ FOREIGN KEY (`group_id`) REFERENCES `group`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_groupPermission`("group_id", "permission") SELECT "groupId", "permission" FROM `groupPermission`;--> statement-breakpoint
+DROP TABLE `groupPermission`;--> statement-breakpoint
+ALTER TABLE `__new_groupPermission` RENAME TO `groupPermission`;--> statement-breakpoint
+CREATE TABLE `__new_icon` (
+ `id` text PRIMARY KEY NOT NULL,
+ `name` text NOT NULL,
+ `url` text NOT NULL,
+ `checksum` text NOT NULL,
+ `icon_repository_id` text NOT NULL,
+ FOREIGN KEY (`icon_repository_id`) REFERENCES `iconRepository`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_icon`("id", "name", "url", "checksum", "icon_repository_id") SELECT "icon_id", "icon_name", "icon_url", "icon_checksum", "iconRepository_id" FROM `icon`;--> statement-breakpoint
+DROP TABLE `icon`;--> statement-breakpoint
+ALTER TABLE `__new_icon` RENAME TO `icon`;--> statement-breakpoint
+DROP INDEX IF EXISTS `serverSetting_key_unique`;--> statement-breakpoint
+CREATE UNIQUE INDEX `serverSetting_settingKey_unique` ON `serverSetting` (`setting_key`);--> statement-breakpoint
+CREATE TABLE `__new_session` (
+ `session_token` text PRIMARY KEY NOT NULL,
+ `user_id` text NOT NULL,
+ `expires` integer NOT NULL,
+ FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
+);
+--> statement-breakpoint
+INSERT INTO `__new_session`("session_token", "user_id", "expires") SELECT "sessionToken", "userId", "expires" FROM `session`;--> statement-breakpoint
+DROP TABLE `session`;--> statement-breakpoint
+ALTER TABLE `__new_session` RENAME TO `session`;--> statement-breakpoint
+CREATE INDEX `user_id_idx` ON `session` (`user_id`);--> statement-breakpoint
+CREATE TABLE `__new_user` (
+ `id` text PRIMARY KEY NOT NULL,
+ `name` text,
+ `email` text,
+ `email_verified` integer,
+ `image` text,
+ `password` text,
+ `salt` text,
+ `provider` text DEFAULT 'credentials' NOT NULL,
+ `home_board_id` text,
+ `color_scheme` text DEFAULT 'dark' NOT NULL,
+ `first_day_of_week` integer DEFAULT 1 NOT NULL,
+ `ping_icons_enabled` integer DEFAULT false NOT NULL,
+ FOREIGN KEY (`home_board_id`) REFERENCES `board`(`id`) ON UPDATE no action ON DELETE set null
+);
+--> statement-breakpoint
+INSERT INTO `__new_user`("id", "name", "email", "email_verified", "image", "password", "salt", "provider", "home_board_id", "color_scheme", "first_day_of_week", "ping_icons_enabled") SELECT "id", "name", "email", "emailVerified", "image", "password", "salt", "provider", "homeBoardId", "colorScheme", "firstDayOfWeek", "pingIconsEnabled" FROM `user`;--> statement-breakpoint
+DROP TABLE `user`;--> statement-breakpoint
+ALTER TABLE `__new_user` RENAME TO `user`;--> statement-breakpoint
+PRAGMA foreign_keys=ON;
\ No newline at end of file
diff --git a/packages/db/migrations/sqlite/meta/0016_snapshot.json b/packages/db/migrations/sqlite/meta/0016_snapshot.json
new file mode 100644
index 000000000..0d22ead90
--- /dev/null
+++ b/packages/db/migrations/sqlite/meta/0016_snapshot.json
@@ -0,0 +1,1579 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "e1f073f2-71de-489f-8268-4754a7ccff10",
+ "prevId": "605f3ca8-6cf3-4f5f-afd3-88d5190377b6",
+ "tables": {
+ "account": {
+ "name": "account",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider_account_id": {
+ "name": "provider_account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "token_type": {
+ "name": "token_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "session_state": {
+ "name": "session_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "userId_idx": {
+ "name": "userId_idx",
+ "columns": ["user_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "account_user_id_user_id_fk": {
+ "name": "account_user_id_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "account_provider_provider_account_id_pk": {
+ "columns": ["provider", "provider_account_id"],
+ "name": "account_provider_provider_account_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "apiKey": {
+ "name": "apiKey",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "api_key": {
+ "name": "api_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "salt": {
+ "name": "salt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "apiKey_user_id_user_id_fk": {
+ "name": "apiKey_user_id_user_id_fk",
+ "tableFrom": "apiKey",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "app": {
+ "name": "app",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "icon_url": {
+ "name": "icon_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "href": {
+ "name": "href",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "boardGroupPermission": {
+ "name": "boardGroupPermission",
+ "columns": {
+ "board_id": {
+ "name": "board_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "permission": {
+ "name": "permission",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "boardGroupPermission_board_id_board_id_fk": {
+ "name": "boardGroupPermission_board_id_board_id_fk",
+ "tableFrom": "boardGroupPermission",
+ "tableTo": "board",
+ "columnsFrom": ["board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "boardGroupPermission_group_id_group_id_fk": {
+ "name": "boardGroupPermission_group_id_group_id_fk",
+ "tableFrom": "boardGroupPermission",
+ "tableTo": "group",
+ "columnsFrom": ["group_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "boardGroupPermission_board_id_group_id_permission_pk": {
+ "columns": ["board_id", "group_id", "permission"],
+ "name": "boardGroupPermission_board_id_group_id_permission_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "boardUserPermission": {
+ "name": "boardUserPermission",
+ "columns": {
+ "board_id": {
+ "name": "board_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "permission": {
+ "name": "permission",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "boardUserPermission_board_id_board_id_fk": {
+ "name": "boardUserPermission_board_id_board_id_fk",
+ "tableFrom": "boardUserPermission",
+ "tableTo": "board",
+ "columnsFrom": ["board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "boardUserPermission_user_id_user_id_fk": {
+ "name": "boardUserPermission_user_id_user_id_fk",
+ "tableFrom": "boardUserPermission",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "boardUserPermission_board_id_user_id_permission_pk": {
+ "columns": ["board_id", "user_id", "permission"],
+ "name": "boardUserPermission_board_id_user_id_permission_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "board": {
+ "name": "board",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_public": {
+ "name": "is_public",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "creator_id": {
+ "name": "creator_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "page_title": {
+ "name": "page_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "meta_title": {
+ "name": "meta_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "logo_image_url": {
+ "name": "logo_image_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "favicon_image_url": {
+ "name": "favicon_image_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "background_image_url": {
+ "name": "background_image_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "background_image_attachment": {
+ "name": "background_image_attachment",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'fixed'"
+ },
+ "background_image_repeat": {
+ "name": "background_image_repeat",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'no-repeat'"
+ },
+ "background_image_size": {
+ "name": "background_image_size",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'cover'"
+ },
+ "primary_color": {
+ "name": "primary_color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'#fa5252'"
+ },
+ "secondary_color": {
+ "name": "secondary_color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'#fd7e14'"
+ },
+ "opacity": {
+ "name": "opacity",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 100
+ },
+ "custom_css": {
+ "name": "custom_css",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "column_count": {
+ "name": "column_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 10
+ }
+ },
+ "indexes": {
+ "board_name_unique": {
+ "name": "board_name_unique",
+ "columns": ["name"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "board_creator_id_user_id_fk": {
+ "name": "board_creator_id_user_id_fk",
+ "tableFrom": "board",
+ "tableTo": "user",
+ "columnsFrom": ["creator_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "groupMember": {
+ "name": "groupMember",
+ "columns": {
+ "group_id": {
+ "name": "group_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "groupMember_group_id_group_id_fk": {
+ "name": "groupMember_group_id_group_id_fk",
+ "tableFrom": "groupMember",
+ "tableTo": "group",
+ "columnsFrom": ["group_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "groupMember_user_id_user_id_fk": {
+ "name": "groupMember_user_id_user_id_fk",
+ "tableFrom": "groupMember",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "groupMember_group_id_user_id_pk": {
+ "columns": ["group_id", "user_id"],
+ "name": "groupMember_group_id_user_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "groupPermission": {
+ "name": "groupPermission",
+ "columns": {
+ "group_id": {
+ "name": "group_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "permission": {
+ "name": "permission",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "groupPermission_group_id_group_id_fk": {
+ "name": "groupPermission_group_id_group_id_fk",
+ "tableFrom": "groupPermission",
+ "tableTo": "group",
+ "columnsFrom": ["group_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "group": {
+ "name": "group",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "group_name_unique": {
+ "name": "group_name_unique",
+ "columns": ["name"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "group_owner_id_user_id_fk": {
+ "name": "group_owner_id_user_id_fk",
+ "tableFrom": "group",
+ "tableTo": "user",
+ "columnsFrom": ["owner_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "iconRepository": {
+ "name": "iconRepository",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "icon": {
+ "name": "icon",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "checksum": {
+ "name": "checksum",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "icon_repository_id": {
+ "name": "icon_repository_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "icon_icon_repository_id_iconRepository_id_fk": {
+ "name": "icon_icon_repository_id_iconRepository_id_fk",
+ "tableFrom": "icon",
+ "tableTo": "iconRepository",
+ "columnsFrom": ["icon_repository_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "integrationGroupPermissions": {
+ "name": "integrationGroupPermissions",
+ "columns": {
+ "integration_id": {
+ "name": "integration_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "permission": {
+ "name": "permission",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "integrationGroupPermissions_integration_id_integration_id_fk": {
+ "name": "integrationGroupPermissions_integration_id_integration_id_fk",
+ "tableFrom": "integrationGroupPermissions",
+ "tableTo": "integration",
+ "columnsFrom": ["integration_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "integrationGroupPermissions_group_id_group_id_fk": {
+ "name": "integrationGroupPermissions_group_id_group_id_fk",
+ "tableFrom": "integrationGroupPermissions",
+ "tableTo": "group",
+ "columnsFrom": ["group_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "integrationGroupPermissions_integration_id_group_id_permission_pk": {
+ "columns": ["integration_id", "group_id", "permission"],
+ "name": "integrationGroupPermissions_integration_id_group_id_permission_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "integration_item": {
+ "name": "integration_item",
+ "columns": {
+ "item_id": {
+ "name": "item_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "integration_id": {
+ "name": "integration_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "integration_item_item_id_item_id_fk": {
+ "name": "integration_item_item_id_item_id_fk",
+ "tableFrom": "integration_item",
+ "tableTo": "item",
+ "columnsFrom": ["item_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "integration_item_integration_id_integration_id_fk": {
+ "name": "integration_item_integration_id_integration_id_fk",
+ "tableFrom": "integration_item",
+ "tableTo": "integration",
+ "columnsFrom": ["integration_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "integration_item_item_id_integration_id_pk": {
+ "columns": ["item_id", "integration_id"],
+ "name": "integration_item_item_id_integration_id_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "integrationSecret": {
+ "name": "integrationSecret",
+ "columns": {
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "integration_id": {
+ "name": "integration_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "integration_secret__kind_idx": {
+ "name": "integration_secret__kind_idx",
+ "columns": ["kind"],
+ "isUnique": false
+ },
+ "integration_secret__updated_at_idx": {
+ "name": "integration_secret__updated_at_idx",
+ "columns": ["updated_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "integrationSecret_integration_id_integration_id_fk": {
+ "name": "integrationSecret_integration_id_integration_id_fk",
+ "tableFrom": "integrationSecret",
+ "tableTo": "integration",
+ "columnsFrom": ["integration_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "integrationSecret_integration_id_kind_pk": {
+ "columns": ["integration_id", "kind"],
+ "name": "integrationSecret_integration_id_kind_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "integrationUserPermission": {
+ "name": "integrationUserPermission",
+ "columns": {
+ "integration_id": {
+ "name": "integration_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "permission": {
+ "name": "permission",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "integrationUserPermission_integration_id_integration_id_fk": {
+ "name": "integrationUserPermission_integration_id_integration_id_fk",
+ "tableFrom": "integrationUserPermission",
+ "tableTo": "integration",
+ "columnsFrom": ["integration_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "integrationUserPermission_user_id_user_id_fk": {
+ "name": "integrationUserPermission_user_id_user_id_fk",
+ "tableFrom": "integrationUserPermission",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "integrationUserPermission_integration_id_user_id_permission_pk": {
+ "columns": ["integration_id", "user_id", "permission"],
+ "name": "integrationUserPermission_integration_id_user_id_permission_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "integration": {
+ "name": "integration",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "integration__kind_idx": {
+ "name": "integration__kind_idx",
+ "columns": ["kind"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "invite": {
+ "name": "invite",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expiration_date": {
+ "name": "expiration_date",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "creator_id": {
+ "name": "creator_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "invite_token_unique": {
+ "name": "invite_token_unique",
+ "columns": ["token"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "invite_creator_id_user_id_fk": {
+ "name": "invite_creator_id_user_id_fk",
+ "tableFrom": "invite",
+ "tableTo": "user",
+ "columnsFrom": ["creator_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "item": {
+ "name": "item",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "section_id": {
+ "name": "section_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "x_offset": {
+ "name": "x_offset",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "y_offset": {
+ "name": "y_offset",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "width": {
+ "name": "width",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "height": {
+ "name": "height",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "options": {
+ "name": "options",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{\"json\": {}}'"
+ },
+ "advanced_options": {
+ "name": "advanced_options",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{\"json\": {}}'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "item_section_id_section_id_fk": {
+ "name": "item_section_id_section_id_fk",
+ "tableFrom": "item",
+ "tableTo": "section",
+ "columnsFrom": ["section_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "media": {
+ "name": "media",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "blob",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content_type": {
+ "name": "content_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "size": {
+ "name": "size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "(unixepoch())"
+ },
+ "creator_id": {
+ "name": "creator_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "media_creator_id_user_id_fk": {
+ "name": "media_creator_id_user_id_fk",
+ "tableFrom": "media",
+ "tableTo": "user",
+ "columnsFrom": ["creator_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "search_engine": {
+ "name": "search_engine",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "icon_url": {
+ "name": "icon_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "short": {
+ "name": "short",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "url_template": {
+ "name": "url_template",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'generic'"
+ },
+ "integration_id": {
+ "name": "integration_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "search_engine_integration_id_integration_id_fk": {
+ "name": "search_engine_integration_id_integration_id_fk",
+ "tableFrom": "search_engine",
+ "tableTo": "integration",
+ "columnsFrom": ["integration_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "section": {
+ "name": "section",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "board_id": {
+ "name": "board_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "x_offset": {
+ "name": "x_offset",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "y_offset": {
+ "name": "y_offset",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "width": {
+ "name": "width",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "height": {
+ "name": "height",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "parent_section_id": {
+ "name": "parent_section_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "section_board_id_board_id_fk": {
+ "name": "section_board_id_board_id_fk",
+ "tableFrom": "section",
+ "tableTo": "board",
+ "columnsFrom": ["board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "section_parent_section_id_section_id_fk": {
+ "name": "section_parent_section_id_section_id_fk",
+ "tableFrom": "section",
+ "tableTo": "section",
+ "columnsFrom": ["parent_section_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "serverSetting": {
+ "name": "serverSetting",
+ "columns": {
+ "setting_key": {
+ "name": "setting_key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{\"json\": {}}'"
+ }
+ },
+ "indexes": {
+ "serverSetting_settingKey_unique": {
+ "name": "serverSetting_settingKey_unique",
+ "columns": ["setting_key"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "session": {
+ "name": "session",
+ "columns": {
+ "session_token": {
+ "name": "session_token",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires": {
+ "name": "expires",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "user_id_idx": {
+ "name": "user_id_idx",
+ "columns": ["user_id"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "user": {
+ "name": "user",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "salt": {
+ "name": "salt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'credentials'"
+ },
+ "home_board_id": {
+ "name": "home_board_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "color_scheme": {
+ "name": "color_scheme",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'dark'"
+ },
+ "first_day_of_week": {
+ "name": "first_day_of_week",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 1
+ },
+ "ping_icons_enabled": {
+ "name": "ping_icons_enabled",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_home_board_id_board_id_fk": {
+ "name": "user_home_board_id_board_id_fk",
+ "tableFrom": "user",
+ "tableTo": "board",
+ "columnsFrom": ["home_board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "verificationToken": {
+ "name": "verificationToken",
+ "columns": {
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires": {
+ "name": "expires",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "verificationToken_identifier_token_pk": {
+ "columns": ["identifier", "token"],
+ "name": "verificationToken_identifier_token_pk"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ }
+ },
+ "views": {},
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {
+ "\"account\".\"userId\"": "\"account\".\"user_id\"",
+ "\"account\".\"providerAccountId\"": "\"account\".\"provider_account_id\"",
+ "\"apiKey\".\"apiKey\"": "\"apiKey\".\"api_key\"",
+ "\"apiKey\".\"userId\"": "\"apiKey\".\"user_id\"",
+ "\"groupMember\".\"groupId\"": "\"groupMember\".\"group_id\"",
+ "\"groupMember\".\"userId\"": "\"groupMember\".\"user_id\"",
+ "\"groupPermission\".\"groupId\"": "\"groupPermission\".\"group_id\"",
+ "\"iconRepository\".\"iconRepository_id\"": "\"iconRepository\".\"id\"",
+ "\"iconRepository\".\"iconRepository_slug\"": "\"iconRepository\".\"slug\"",
+ "\"icon\".\"icon_id\"": "\"icon\".\"id\"",
+ "\"icon\".\"icon_name\"": "\"icon\".\"name\"",
+ "\"icon\".\"icon_url\"": "\"icon\".\"url\"",
+ "\"icon\".\"icon_checksum\"": "\"icon\".\"checksum\"",
+ "\"icon\".\"iconRepository_id\"": "\"icon\".\"icon_repository_id\"",
+ "\"serverSetting\".\"key\"": "\"serverSetting\".\"setting_key\"",
+ "\"session\".\"sessionToken\"": "\"session\".\"session_token\"",
+ "\"session\".\"userId\"": "\"session\".\"user_id\"",
+ "\"user\".\"emailVerified\"": "\"user\".\"email_verified\"",
+ "\"user\".\"homeBoardId\"": "\"user\".\"home_board_id\"",
+ "\"user\".\"colorScheme\"": "\"user\".\"color_scheme\"",
+ "\"user\".\"firstDayOfWeek\"": "\"user\".\"first_day_of_week\"",
+ "\"user\".\"pingIconsEnabled\"": "\"user\".\"ping_icons_enabled\""
+ }
+ },
+ "internal": {
+ "indexes": {}
+ }
+}
diff --git a/packages/db/migrations/sqlite/meta/_journal.json b/packages/db/migrations/sqlite/meta/_journal.json
index 3fdf0a8da..8367929b9 100644
--- a/packages/db/migrations/sqlite/meta/_journal.json
+++ b/packages/db/migrations/sqlite/meta/_journal.json
@@ -113,6 +113,13 @@
"when": 1730653336134,
"tag": "0015_superb_psylocke",
"breakpoints": true
+ },
+ {
+ "idx": 16,
+ "version": "6",
+ "when": 1732210918783,
+ "tag": "0016_change_all_to_snake_case",
+ "breakpoints": true
}
]
}
diff --git a/packages/db/migrations/sqlite/migrate.ts b/packages/db/migrations/sqlite/migrate.ts
index 47a901745..420169677 100644
--- a/packages/db/migrations/sqlite/migrate.ts
+++ b/packages/db/migrations/sqlite/migrate.ts
@@ -10,7 +10,7 @@ const migrationsFolder = process.argv[2] ?? ".";
const migrateAsync = async () => {
const sqlite = new Database(process.env.DB_URL?.replace("file:", ""));
- const db = drizzle(sqlite, { schema });
+ const db = drizzle(sqlite, { schema, casing: "snake_case" });
migrate(db, { migrationsFolder });
diff --git a/packages/db/schema/mysql.ts b/packages/db/schema/mysql.ts
index 062da629b..822e06795 100644
--- a/packages/db/schema/mysql.ts
+++ b/packages/db/schema/mysql.ts
@@ -39,10 +39,10 @@ const customBlob = customType<{ data: Buffer }>({
});
export const apiKeys = mysqlTable("apiKey", {
- id: varchar("id", { length: 64 }).notNull().primaryKey(),
- apiKey: text("apiKey").notNull(),
- salt: text("salt").notNull(),
- userId: varchar("userId", { length: 64 })
+ id: varchar({ length: 64 }).notNull().primaryKey(),
+ apiKey: text().notNull(),
+ salt: text().notNull(),
+ userId: varchar({ length: 64 })
.notNull()
.references((): AnyMySqlColumn => users.id, {
onDelete: "cascade",
@@ -50,38 +50,38 @@ export const apiKeys = mysqlTable("apiKey", {
});
export const users = mysqlTable("user", {
- id: varchar("id", { length: 64 }).notNull().primaryKey(),
- name: text("name"),
- email: text("email"),
- emailVerified: timestamp("emailVerified"),
- image: text("image"),
- password: text("password"),
- salt: text("salt"),
- provider: varchar("provider", { length: 64 }).$type<SupportedAuthProvider>().default("credentials").notNull(),
- homeBoardId: varchar("homeBoardId", { length: 64 }).references((): AnyMySqlColumn => boards.id, {
+ id: varchar({ length: 64 }).notNull().primaryKey(),
+ name: text(),
+ email: text(),
+ emailVerified: timestamp(),
+ image: text(),
+ password: text(),
+ salt: text(),
+ provider: varchar({ length: 64 }).$type<SupportedAuthProvider>().default("credentials").notNull(),
+ homeBoardId: varchar({ length: 64 }).references((): AnyMySqlColumn => boards.id, {
onDelete: "set null",
}),
- colorScheme: varchar("colorScheme", { length: 5 }).$type<ColorScheme>().default("dark").notNull(),
- firstDayOfWeek: tinyint("firstDayOfWeek").$type<DayOfWeek>().default(1).notNull(), // Defaults to Monday
- pingIconsEnabled: boolean("pingIconsEnabled").default(false).notNull(),
+ colorScheme: varchar({ length: 5 }).$type<ColorScheme>().default("dark").notNull(),
+ firstDayOfWeek: tinyint().$type<DayOfWeek>().default(1).notNull(), // Defaults to Monday
+ pingIconsEnabled: boolean().default(false).notNull(),
});
export const accounts = mysqlTable(
"account",
{
- userId: varchar("userId", { length: 64 })
+ userId: varchar({ length: 64 })
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
- type: text("type").$type<AdapterAccount["type"]>().notNull(),
- provider: varchar("provider", { length: 64 }).notNull(),
- providerAccountId: varchar("providerAccountId", { length: 64 }).notNull(),
- refresh_token: text("refresh_token"),
- access_token: text("access_token"),
- expires_at: int("expires_at"),
- token_type: text("token_type"),
- scope: text("scope"),
- id_token: text("id_token"),
- session_state: text("session_state"),
+ type: text().$type<AdapterAccount["type"]>().notNull(),
+ provider: varchar({ length: 64 }).notNull(),
+ providerAccountId: varchar({ length: 64 }).notNull(),
+ refresh_token: text(),
+ access_token: text(),
+ expires_at: int(),
+ token_type: text(),
+ scope: text(),
+ id_token: text(),
+ session_state: text(),
},
(account) => ({
compoundKey: primaryKey({
@@ -94,11 +94,11 @@ export const accounts = mysqlTable(
export const sessions = mysqlTable(
"session",
{
- sessionToken: varchar("sessionToken", { length: 512 }).notNull().primaryKey(),
- userId: varchar("userId", { length: 64 })
+ sessionToken: varchar({ length: 512 }).notNull().primaryKey(),
+ userId: varchar({ length: 64 })
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
- expires: timestamp("expires").notNull(),
+ expires: timestamp().notNull(),
},
(session) => ({
userIdIdx: index("user_id_idx").on(session.userId),
@@ -108,9 +108,9 @@ export const sessions = mysqlTable(
export const verificationTokens = mysqlTable(
"verificationToken",
{
- identifier: varchar("identifier", { length: 64 }).notNull(),
- token: varchar("token", { length: 512 }).notNull(),
- expires: timestamp("expires").notNull(),
+ identifier: varchar({ length: 64 }).notNull(),
+ token: varchar({ length: 512 }).notNull(),
+ expires: timestamp().notNull(),
},
(verificationToken) => ({
compoundKey: primaryKey({
@@ -122,10 +122,10 @@ export const verificationTokens = mysqlTable(
export const groupMembers = mysqlTable(
"groupMember",
{
- groupId: varchar("groupId", { length: 64 })
+ groupId: varchar({ length: 64 })
.notNull()
.references(() => groups.id, { onDelete: "cascade" }),
- userId: varchar("userId", { length: 64 })
+ userId: varchar({ length: 64 })
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
},
@@ -137,46 +137,46 @@ export const groupMembers = mysqlTable(
);
export const groups = mysqlTable("group", {
- id: varchar("id", { length: 64 }).notNull().primaryKey(),
- name: varchar("name", { length: 64 }).unique().notNull(),
- ownerId: varchar("owner_id", { length: 64 }).references(() => users.id, {
+ id: varchar({ length: 64 }).notNull().primaryKey(),
+ name: varchar({ length: 64 }).unique().notNull(),
+ ownerId: varchar({ length: 64 }).references(() => users.id, {
onDelete: "set null",
}),
});
export const groupPermissions = mysqlTable("groupPermission", {
- groupId: varchar("groupId", { length: 64 })
+ groupId: varchar({ length: 64 })
.notNull()
.references(() => groups.id, { onDelete: "cascade" }),
- permission: text("permission").$type<GroupPermissionKey>().notNull(),
+ permission: text().$type<GroupPermissionKey>().notNull(),
});
export const invites = mysqlTable("invite", {
- id: varchar("id", { length: 64 }).notNull().primaryKey(),
- token: varchar("token", { length: 512 }).notNull().unique(),
- expirationDate: timestamp("expiration_date").notNull(),
- creatorId: varchar("creator_id", { length: 64 })
+ id: varchar({ length: 64 }).notNull().primaryKey(),
+ token: varchar({ length: 512 }).notNull().unique(),
+ expirationDate: timestamp().notNull(),
+ creatorId: varchar({ length: 64 })
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
});
export const medias = mysqlTable("media", {
- id: varchar("id", { length: 64 }).notNull().primaryKey(),
- name: varchar("name", { length: 512 }).notNull(),
- content: customBlob("content").notNull(),
- contentType: text("content_type").notNull(),
- size: int("size").notNull(),
- createdAt: timestamp("created_at", { mode: "date" }).notNull().defaultNow(),
- creatorId: varchar("creator_id", { length: 64 }).references(() => users.id, { onDelete: "set null" }),
+ id: varchar({ length: 64 }).notNull().primaryKey(),
+ name: varchar({ length: 512 }).notNull(),
+ content: customBlob().notNull(),
+ contentType: text().notNull(),
+ size: int().notNull(),
+ createdAt: timestamp({ mode: "date" }).notNull().defaultNow(),
+ creatorId: varchar({ length: 64 }).references(() => users.id, { onDelete: "set null" }),
});
export const integrations = mysqlTable(
"integration",
{
- id: varchar("id", { length: 64 }).notNull().primaryKey(),
- name: text("name").notNull(),
- url: text("url").notNull(),
- kind: varchar("kind", { length: 128 }).$type<IntegrationKind>().notNull(),
+ id: varchar({ length: 64 }).notNull().primaryKey(),
+ name: text().notNull(),
+ url: text().notNull(),
+ kind: varchar({ length: 128 }).$type<IntegrationKind>().notNull(),
},
(integrations) => ({
kindIdx: index("integration__kind_idx").on(integrations.kind),
@@ -186,12 +186,12 @@ export const integrations = mysqlTable(
export const integrationSecrets = mysqlTable(
"integrationSecret",
{
- kind: varchar("kind", { length: 16 }).$type<IntegrationSecretKind>().notNull(),
- value: text("value").$type<`${string}.${string}`>().notNull(),
- updatedAt: timestamp("updated_at")
+ kind: varchar({ length: 16 }).$type<IntegrationSecretKind>().notNull(),
+ value: text().$type<`${string}.${string}`>().notNull(),
+ updatedAt: timestamp()
.$onUpdateFn(() => new Date())
.notNull(),
- integrationId: varchar("integration_id", { length: 64 })
+ integrationId: varchar({ length: 64 })
.notNull()
.references(() => integrations.id, { onDelete: "cascade" }),
},
@@ -207,13 +207,13 @@ export const integrationSecrets = mysqlTable(
export const integrationUserPermissions = mysqlTable(
"integrationUserPermission",
{
- integrationId: varchar("integration_id", { length: 64 })
+ integrationId: varchar({ length: 64 })
.notNull()
.references(() => integrations.id, { onDelete: "cascade" }),
- userId: varchar("user_id", { length: 64 })
+ userId: varchar({ length: 64 })
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
- permission: varchar("permission", { length: 128 }).$type<IntegrationPermission>().notNull(),
+ permission: varchar({ length: 128 }).$type<IntegrationPermission>().notNull(),
},
(table) => ({
compoundKey: primaryKey({
@@ -225,13 +225,13 @@ export const integrationUserPermissions = mysqlTable(
export const integrationGroupPermissions = mysqlTable(
"integrationGroupPermissions",
{
- integrationId: varchar("integration_id", { length: 64 })
+ integrationId: varchar({ length: 64 })
.notNull()
.references(() => integrations.id, { onDelete: "cascade" }),
- groupId: varchar("group_id", { length: 64 })
+ groupId: varchar({ length: 64 })
.notNull()
.references(() => groups.id, { onDelete: "cascade" }),
- permission: varchar("permission", { length: 128 }).$type<IntegrationPermission>().notNull(),
+ permission: varchar({ length: 128 }).$type<IntegrationPermission>().notNull(),
},
(table) => ({
compoundKey: primaryKey({
@@ -242,46 +242,40 @@ export const integrationGroupPermissions = mysqlTable(
);
export const boards = mysqlTable("board", {
- id: varchar("id", { length: 64 }).notNull().primaryKey(),
- name: varchar("name", { length: 256 }).unique().notNull(),
- isPublic: boolean("is_public").default(false).notNull(),
- creatorId: varchar("creator_id", { length: 64 }).references(() => users.id, {
+ id: varchar({ length: 64 }).notNull().primaryKey(),
+ name: varchar({ length: 256 }).unique().notNull(),
+ isPublic: boolean().default(false).notNull(),
+ creatorId: varchar({ length: 64 }).references(() => users.id, {
onDelete: "set null",
}),
- pageTitle: text("page_title"),
- metaTitle: text("meta_title"),
- logoImageUrl: text("logo_image_url"),
- faviconImageUrl: text("favicon_image_url"),
- backgroundImageUrl: text("background_image_url"),
- backgroundImageAttachment: text("background_image_attachment")
+ pageTitle: text(),
+ metaTitle: text(),
+ logoImageUrl: text(),
+ faviconImageUrl: text(),
+ backgroundImageUrl: text(),
+ backgroundImageAttachment: text()
.$type<BackgroundImageAttachment>()
.default(backgroundImageAttachments.defaultValue)
.notNull(),
- backgroundImageRepeat: text("background_image_repeat")
- .$type<BackgroundImageRepeat>()
- .default(backgroundImageRepeats.defaultValue)
- .notNull(),
- backgroundImageSize: text("background_image_size")
- .$type<BackgroundImageSize>()
- .default(backgroundImageSizes.defaultValue)
- .notNull(),
- primaryColor: text("primary_color").default("#fa5252").notNull(),
- secondaryColor: text("secondary_color").default("#fd7e14").notNull(),
- opacity: int("opacity").default(100).notNull(),
- customCss: text("custom_css"),
- columnCount: int("column_count").default(10).notNull(),
+ backgroundImageRepeat: text().$type<BackgroundImageRepeat>().default(backgroundImageRepeats.defaultValue).notNull(),
+ backgroundImageSize: text().$type<BackgroundImageSize>().default(backgroundImageSizes.defaultValue).notNull(),
+ primaryColor: text().default("#fa5252").notNull(),
+ secondaryColor: text().default("#fd7e14").notNull(),
+ opacity: int().default(100).notNull(),
+ customCss: text(),
+ columnCount: int().default(10).notNull(),
});
export const boardUserPermissions = mysqlTable(
"boardUserPermission",
{
- boardId: varchar("board_id", { length: 64 })
+ boardId: varchar({ length: 64 })
.notNull()
.references(() => boards.id, { onDelete: "cascade" }),
- userId: varchar("user_id", { length: 64 })
+ userId: varchar({ length: 64 })
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
- permission: varchar("permission", { length: 128 }).$type<BoardPermission>().notNull(),
+ permission: varchar({ length: 128 }).$type<BoardPermission>().notNull(),
},
(table) => ({
compoundKey: primaryKey({
@@ -293,13 +287,13 @@ export const boardUserPermissions = mysqlTable(
export const boardGroupPermissions = mysqlTable(
"boardGroupPermission",
{
- boardId: varchar("board_id", { length: 64 })
+ boardId: varchar({ length: 64 })
.notNull()
.references(() => boards.id, { onDelete: "cascade" }),
- groupId: varchar("group_id", { length: 64 })
+ groupId: varchar({ length: 64 })
.notNull()
.references(() => groups.id, { onDelete: "cascade" }),
- permission: varchar("permission", { length: 128 }).$type<BoardPermission>().notNull(),
+ permission: varchar({ length: 128 }).$type<BoardPermission>().notNull(),
},
(table) => ({
compoundKey: primaryKey({
@@ -309,50 +303,50 @@ export const boardGroupPermissions = mysqlTable(
);
export const sections = mysqlTable("section", {
- id: varchar("id", { length: 64 }).notNull().primaryKey(),
- boardId: varchar("board_id", { length: 64 })
+ id: varchar({ length: 64 }).notNull().primaryKey(),
+ boardId: varchar({ length: 64 })
.notNull()
.references(() => boards.id, { onDelete: "cascade" }),
- kind: text("kind").$type<SectionKind>().notNull(),
- xOffset: int("x_offset").notNull(),
- yOffset: int("y_offset").notNull(),
- width: int("width"),
- height: int("height"),
- name: text("name"),
- parentSectionId: varchar("parent_section_id", { length: 64 }).references((): AnyMySqlColumn => sections.id, {
+ kind: text().$type<SectionKind>().notNull(),
+ xOffset: int().notNull(),
+ yOffset: int().notNull(),
+ width: int(),
+ height: int(),
+ name: text(),
+ parentSectionId: varchar({ length: 64 }).references((): AnyMySqlColumn => sections.id, {
onDelete: "cascade",
}),
});
export const items = mysqlTable("item", {
- id: varchar("id", { length: 64 }).notNull().primaryKey(),
- sectionId: varchar("section_id", { length: 64 })
+ id: varchar({ length: 64 }).notNull().primaryKey(),
+ sectionId: varchar({ length: 64 })
.notNull()
.references(() => sections.id, { onDelete: "cascade" }),
- kind: text("kind").$type<WidgetKind>().notNull(),
- xOffset: int("x_offset").notNull(),
- yOffset: int("y_offset").notNull(),
- width: int("width").notNull(),
- height: int("height").notNull(),
- options: text("options").default('{"json": {}}').notNull(), // empty superjson object
- advancedOptions: text("advanced_options").default('{"json": {}}').notNull(), // empty superjson object
+ kind: text().$type<WidgetKind>().notNull(),
+ xOffset: int().notNull(),
+ yOffset: int().notNull(),
+ width: int().notNull(),
+ height: int().notNull(),
+ options: text().default('{"json": {}}').notNull(), // empty superjson object
+ advancedOptions: text().default('{"json": {}}').notNull(), // empty superjson object
});
export const apps = mysqlTable("app", {
- id: varchar("id", { length: 64 }).notNull().primaryKey(),
- name: text("name").notNull(),
- description: text("description"),
- iconUrl: text("icon_url").notNull(),
- href: text("href"),
+ id: varchar({ length: 64 }).notNull().primaryKey(),
+ name: text().notNull(),
+ description: text(),
+ iconUrl: text().notNull(),
+ href: text(),
});
export const integrationItems = mysqlTable(
"integration_item",
{
- itemId: varchar("item_id", { length: 64 })
+ itemId: varchar({ length: 64 })
.notNull()
.references(() => items.id, { onDelete: "cascade" }),
- integrationId: varchar("integration_id", { length: 64 })
+ integrationId: varchar({ length: 64 })
.notNull()
.references(() => integrations.id, { onDelete: "cascade" }),
},
@@ -364,23 +358,23 @@ export const integrationItems = mysqlTable(
);
export const icons = mysqlTable("icon", {
- id: varchar("icon_id", { length: 64 }).notNull().primaryKey(),
- name: varchar("icon_name", { length: 250 }).notNull(),
- url: text("icon_url").notNull(),
- checksum: text("icon_checksum").notNull(),
- iconRepositoryId: varchar("iconRepository_id", { length: 64 })
+ id: varchar({ length: 64 }).notNull().primaryKey(),
+ name: varchar({ length: 250 }).notNull(),
+ url: text().notNull(),
+ checksum: text().notNull(),
+ iconRepositoryId: varchar({ length: 64 })
.notNull()
.references(() => iconRepositories.id, { onDelete: "cascade" }),
});
export const iconRepositories = mysqlTable("iconRepository", {
- id: varchar("iconRepository_id", { length: 64 }).notNull().primaryKey(),
- slug: varchar("iconRepository_slug", { length: 150 }).notNull(),
+ id: varchar({ length: 64 }).notNull().primaryKey(),
+ slug: varchar({ length: 150 }).notNull(),
});
export const serverSettings = mysqlTable("serverSetting", {
- settingKey: varchar("key", { length: 64 }).notNull().unique().primaryKey(),
- value: text("value").default('{"json": {}}').notNull(), // empty superjson object
+ settingKey: varchar({ length: 64 }).notNull().unique().primaryKey(),
+ value: text().default('{"json": {}}').notNull(), // empty superjson object
});
export const apiKeyRelations = relations(apiKeys, ({ one }) => ({
@@ -391,14 +385,14 @@ export const apiKeyRelations = relations(apiKeys, ({ one }) => ({
}));
export const searchEngines = mysqlTable("search_engine", {
- id: varchar("id", { length: 64 }).notNull().primaryKey(),
- iconUrl: text("icon_url").notNull(),
- name: varchar("name", { length: 64 }).notNull(),
- short: varchar("short", { length: 8 }).notNull(),
- description: text("description"),
- urlTemplate: text("url_template"),
- type: varchar("type", { length: 64 }).$type<SearchEngineType>().notNull().default("generic"),
- integrationId: varchar("integration_id", { length: 64 }).references(() => integrations.id, { onDelete: "cascade" }),
+ id: varchar({ length: 64 }).notNull().primaryKey(),
+ iconUrl: text().notNull(),
+ name: varchar({ length: 64 }).notNull(),
+ short: varchar({ length: 8 }).notNull(),
+ description: text(),
+ urlTemplate: text(),
+ type: varchar({ length: 64 }).$type<SearchEngineType>().notNull().default("generic"),
+ integrationId: varchar({ length: 64 }).references(() => integrations.id, { onDelete: "cascade" }),
});
export const accountRelations = relations(accounts, ({ one }) => ({
diff --git a/packages/db/schema/sqlite.ts b/packages/db/schema/sqlite.ts
index f2f19e71c..fd4158f38 100644
--- a/packages/db/schema/sqlite.ts
+++ b/packages/db/schema/sqlite.ts
@@ -3,7 +3,7 @@ import type { DayOfWeek } from "@mantine/dates";
import type { InferSelectModel } from "drizzle-orm";
import { relations, sql } from "drizzle-orm";
import type { AnySQLiteColumn } from "drizzle-orm/sqlite-core";
-import { blob, index, int, integer, primaryKey, sqliteTable, text } from "drizzle-orm/sqlite-core";
+import { blob, index, int, primaryKey, sqliteTable, text } from "drizzle-orm/sqlite-core";
import { backgroundImageAttachments, backgroundImageRepeats, backgroundImageSizes } from "@homarr/definitions";
import type {
@@ -23,10 +23,10 @@ import type {
} from "@homarr/definitions";
export const apiKeys = sqliteTable("apiKey", {
- id: text("id").notNull().primaryKey(),
- apiKey: text("apiKey").notNull(),
- salt: text("salt").notNull(),
- userId: text("userId")
+ id: text().notNull().primaryKey(),
+ apiKey: text().notNull(),
+ salt: text().notNull(),
+ userId: text()
.notNull()
.references((): AnySQLiteColumn => users.id, {
onDelete: "cascade",
@@ -34,38 +34,38 @@ export const apiKeys = sqliteTable("apiKey", {
});
export const users = sqliteTable("user", {
- id: text("id").notNull().primaryKey(),
- name: text("name"),
- email: text("email"),
- emailVerified: integer("emailVerified", { mode: "timestamp_ms" }),
- image: text("image"),
- password: text("password"),
- salt: text("salt"),
- provider: text("provider").$type<SupportedAuthProvider>().default("credentials").notNull(),
- homeBoardId: text("homeBoardId").references((): AnySQLiteColumn => boards.id, {
+ id: text().notNull().primaryKey(),
+ name: text(),
+ email: text(),
+ emailVerified: int({ mode: "timestamp_ms" }),
+ image: text(),
+ password: text(),
+ salt: text(),
+ provider: text().$type<SupportedAuthProvider>().default("credentials").notNull(),
+ homeBoardId: text().references((): AnySQLiteColumn => boards.id, {
onDelete: "set null",
}),
- colorScheme: text("colorScheme").$type<ColorScheme>().default("dark").notNull(),
- firstDayOfWeek: int("firstDayOfWeek").$type<DayOfWeek>().default(1).notNull(), // Defaults to Monday
- pingIconsEnabled: int("pingIconsEnabled", { mode: "boolean" }).default(false).notNull(),
+ colorScheme: text().$type<ColorScheme>().default("dark").notNull(),
+ firstDayOfWeek: int().$type<DayOfWeek>().default(1).notNull(), // Defaults to Monday
+ pingIconsEnabled: int({ mode: "boolean" }).default(false).notNull(),
});
export const accounts = sqliteTable(
"account",
{
- userId: text("userId")
+ userId: text()
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
- type: text("type").$type<AdapterAccount["type"]>().notNull(),
- provider: text("provider").notNull(),
- providerAccountId: text("providerAccountId").notNull(),
- refresh_token: text("refresh_token"),
- access_token: text("access_token"),
- expires_at: integer("expires_at"),
- token_type: text("token_type"),
- scope: text("scope"),
- id_token: text("id_token"),
- session_state: text("session_state"),
+ type: text().$type<AdapterAccount["type"]>().notNull(),
+ provider: text().notNull(),
+ providerAccountId: text().notNull(),
+ refresh_token: text(),
+ access_token: text(),
+ expires_at: int(),
+ token_type: text(),
+ scope: text(),
+ id_token: text(),
+ session_state: text(),
},
(account) => ({
compoundKey: primaryKey({
@@ -78,11 +78,11 @@ export const accounts = sqliteTable(
export const sessions = sqliteTable(
"session",
{
- sessionToken: text("sessionToken").notNull().primaryKey(),
- userId: text("userId")
+ sessionToken: text().notNull().primaryKey(),
+ userId: text()
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
- expires: integer("expires", { mode: "timestamp_ms" }).notNull(),
+ expires: int({ mode: "timestamp_ms" }).notNull(),
},
(session) => ({
userIdIdx: index("user_id_idx").on(session.userId),
@@ -92,9 +92,9 @@ export const sessions = sqliteTable(
export const verificationTokens = sqliteTable(
"verificationToken",
{
- identifier: text("identifier").notNull(),
- token: text("token").notNull(),
- expires: integer("expires", { mode: "timestamp_ms" }).notNull(),
+ identifier: text().notNull(),
+ token: text().notNull(),
+ expires: int({ mode: "timestamp_ms" }).notNull(),
},
(verificationToken) => ({
compoundKey: primaryKey({
@@ -106,10 +106,10 @@ export const verificationTokens = sqliteTable(
export const groupMembers = sqliteTable(
"groupMember",
{
- groupId: text("groupId")
+ groupId: text()
.notNull()
.references(() => groups.id, { onDelete: "cascade" }),
- userId: text("userId")
+ userId: text()
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
},
@@ -121,50 +121,50 @@ export const groupMembers = sqliteTable(
);
export const groups = sqliteTable("group", {
- id: text("id").notNull().primaryKey(),
- name: text("name").unique().notNull(),
- ownerId: text("owner_id").references(() => users.id, {
+ id: text().notNull().primaryKey(),
+ name: text().unique().notNull(),
+ ownerId: text().references(() => users.id, {
onDelete: "set null",
}),
});
export const groupPermissions = sqliteTable("groupPermission", {
- groupId: text("groupId")
+ groupId: text()
.notNull()
.references(() => groups.id, { onDelete: "cascade" }),
- permission: text("permission").$type<GroupPermissionKey>().notNull(),
+ permission: text().$type<GroupPermissionKey>().notNull(),
});
export const invites = sqliteTable("invite", {
- id: text("id").notNull().primaryKey(),
- token: text("token").notNull().unique(),
- expirationDate: int("expiration_date", {
+ id: text().notNull().primaryKey(),
+ token: text().notNull().unique(),
+ expirationDate: int({
mode: "timestamp",
}).notNull(),
- creatorId: text("creator_id")
+ creatorId: text()
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
});
export const medias = sqliteTable("media", {
- id: text("id").notNull().primaryKey(),
- name: text("name").notNull(),
- content: blob("content", { mode: "buffer" }).$type<Buffer>().notNull(),
- contentType: text("content_type").notNull(),
- size: int("size").notNull(),
- createdAt: integer("created_at", { mode: "timestamp" })
+ id: text().notNull().primaryKey(),
+ name: text().notNull(),
+ content: blob({ mode: "buffer" }).$type<Buffer>().notNull(),
+ contentType: text().notNull(),
+ size: int().notNull(),
+ createdAt: int({ mode: "timestamp" })
.notNull()
.default(sql`(unixepoch())`),
- creatorId: text("creator_id").references(() => users.id, { onDelete: "set null" }),
+ creatorId: text().references(() => users.id, { onDelete: "set null" }),
});
export const integrations = sqliteTable(
"integration",
{
- id: text("id").notNull().primaryKey(),
- name: text("name").notNull(),
- url: text("url").notNull(),
- kind: text("kind").$type<IntegrationKind>().notNull(),
+ id: text().notNull().primaryKey(),
+ name: text().notNull(),
+ url: text().notNull(),
+ kind: text().$type<IntegrationKind>().notNull(),
},
(integrations) => ({
kindIdx: index("integration__kind_idx").on(integrations.kind),
@@ -174,12 +174,12 @@ export const integrations = sqliteTable(
export const integrationSecrets = sqliteTable(
"integrationSecret",
{
- kind: text("kind").$type<IntegrationSecretKind>().notNull(),
- value: text("value").$type<`${string}.${string}`>().notNull(),
- updatedAt: integer("updated_at", { mode: "timestamp" })
+ kind: text().$type<IntegrationSecretKind>().notNull(),
+ value: text().$type<`${string}.${string}`>().notNull(),
+ updatedAt: int({ mode: "timestamp" })
.$onUpdateFn(() => new Date())
.notNull(),
- integrationId: text("integration_id")
+ integrationId: text()
.notNull()
.references(() => integrations.id, { onDelete: "cascade" }),
},
@@ -195,13 +195,13 @@ export const integrationSecrets = sqliteTable(
export const integrationUserPermissions = sqliteTable(
"integrationUserPermission",
{
- integrationId: text("integration_id")
+ integrationId: text()
.notNull()
.references(() => integrations.id, { onDelete: "cascade" }),
- userId: text("user_id")
+ userId: text()
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
- permission: text("permission").$type<IntegrationPermission>().notNull(),
+ permission: text().$type<IntegrationPermission>().notNull(),
},
(table) => ({
compoundKey: primaryKey({
@@ -213,13 +213,13 @@ export const integrationUserPermissions = sqliteTable(
export const integrationGroupPermissions = sqliteTable(
"integrationGroupPermissions",
{
- integrationId: text("integration_id")
+ integrationId: text()
.notNull()
.references(() => integrations.id, { onDelete: "cascade" }),
- groupId: text("group_id")
+ groupId: text()
.notNull()
.references(() => groups.id, { onDelete: "cascade" }),
- permission: text("permission").$type<IntegrationPermission>().notNull(),
+ permission: text().$type<IntegrationPermission>().notNull(),
},
(table) => ({
compoundKey: primaryKey({
@@ -229,46 +229,40 @@ export const integrationGroupPermissions = sqliteTable(
);
export const boards = sqliteTable("board", {
- id: text("id").notNull().primaryKey(),
- name: text("name").unique().notNull(),
- isPublic: int("is_public", { mode: "boolean" }).default(false).notNull(),
- creatorId: text("creator_id").references(() => users.id, {
+ id: text().notNull().primaryKey(),
+ name: text().unique().notNull(),
+ isPublic: int({ mode: "boolean" }).default(false).notNull(),
+ creatorId: text().references(() => users.id, {
onDelete: "set null",
}),
- pageTitle: text("page_title"),
- metaTitle: text("meta_title"),
- logoImageUrl: text("logo_image_url"),
- faviconImageUrl: text("favicon_image_url"),
- backgroundImageUrl: text("background_image_url"),
- backgroundImageAttachment: text("background_image_attachment")
+ pageTitle: text(),
+ metaTitle: text(),
+ logoImageUrl: text(),
+ faviconImageUrl: text(),
+ backgroundImageUrl: text(),
+ backgroundImageAttachment: text()
.$type<BackgroundImageAttachment>()
.default(backgroundImageAttachments.defaultValue)
.notNull(),
- backgroundImageRepeat: text("background_image_repeat")
- .$type<BackgroundImageRepeat>()
- .default(backgroundImageRepeats.defaultValue)
- .notNull(),
- backgroundImageSize: text("background_image_size")
- .$type<BackgroundImageSize>()
- .default(backgroundImageSizes.defaultValue)
- .notNull(),
- primaryColor: text("primary_color").default("#fa5252").notNull(),
- secondaryColor: text("secondary_color").default("#fd7e14").notNull(),
- opacity: int("opacity").default(100).notNull(),
- customCss: text("custom_css"),
- columnCount: int("column_count").default(10).notNull(),
+ backgroundImageRepeat: text().$type<BackgroundImageRepeat>().default(backgroundImageRepeats.defaultValue).notNull(),
+ backgroundImageSize: text().$type<BackgroundImageSize>().default(backgroundImageSizes.defaultValue).notNull(),
+ primaryColor: text().default("#fa5252").notNull(),
+ secondaryColor: text().default("#fd7e14").notNull(),
+ opacity: int().default(100).notNull(),
+ customCss: text(),
+ columnCount: int().default(10).notNull(),
});
export const boardUserPermissions = sqliteTable(
"boardUserPermission",
{
- boardId: text("board_id")
+ boardId: text()
.notNull()
.references(() => boards.id, { onDelete: "cascade" }),
- userId: text("user_id")
+ userId: text()
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
- permission: text("permission").$type<BoardPermission>().notNull(),
+ permission: text().$type<BoardPermission>().notNull(),
},
(table) => ({
compoundKey: primaryKey({
@@ -280,13 +274,13 @@ export const boardUserPermissions = sqliteTable(
export const boardGroupPermissions = sqliteTable(
"boardGroupPermission",
{
- boardId: text("board_id")
+ boardId: text()
.notNull()
.references(() => boards.id, { onDelete: "cascade" }),
- groupId: text("group_id")
+ groupId: text()
.notNull()
.references(() => groups.id, { onDelete: "cascade" }),
- permission: text("permission").$type<BoardPermission>().notNull(),
+ permission: text().$type<BoardPermission>().notNull(),
},
(table) => ({
compoundKey: primaryKey({
@@ -296,50 +290,50 @@ export const boardGroupPermissions = sqliteTable(
);
export const sections = sqliteTable("section", {
- id: text("id").notNull().primaryKey(),
- boardId: text("board_id")
+ id: text().notNull().primaryKey(),
+ boardId: text()
.notNull()
.references(() => boards.id, { onDelete: "cascade" }),
- kind: text("kind").$type<SectionKind>().notNull(),
- xOffset: int("x_offset").notNull(),
- yOffset: int("y_offset").notNull(),
- width: int("width"),
- height: int("height"),
- name: text("name"),
- parentSectionId: text("parent_section_id").references((): AnySQLiteColumn => sections.id, {
+ kind: text().$type<SectionKind>().notNull(),
+ xOffset: int().notNull(),
+ yOffset: int().notNull(),
+ width: int(),
+ height: int(),
+ name: text(),
+ parentSectionId: text().references((): AnySQLiteColumn => sections.id, {
onDelete: "cascade",
}),
});
export const items = sqliteTable("item", {
- id: text("id").notNull().primaryKey(),
- sectionId: text("section_id")
+ id: text().notNull().primaryKey(),
+ sectionId: text()
.notNull()
.references(() => sections.id, { onDelete: "cascade" }),
- kind: text("kind").$type<WidgetKind>().notNull(),
- xOffset: int("x_offset").notNull(),
- yOffset: int("y_offset").notNull(),
- width: int("width").notNull(),
- height: int("height").notNull(),
- options: text("options").default('{"json": {}}').notNull(), // empty superjson object
- advancedOptions: text("advanced_options").default('{"json": {}}').notNull(), // empty superjson object
+ kind: text().$type<WidgetKind>().notNull(),
+ xOffset: int().notNull(),
+ yOffset: int().notNull(),
+ width: int().notNull(),
+ height: int().notNull(),
+ options: text().default('{"json": {}}').notNull(), // empty superjson object
+ advancedOptions: text().default('{"json": {}}').notNull(), // empty superjson object
});
export const apps = sqliteTable("app", {
- id: text("id").notNull().primaryKey(),
- name: text("name").notNull(),
- description: text("description"),
- iconUrl: text("icon_url").notNull(),
- href: text("href"),
+ id: text().notNull().primaryKey(),
+ name: text().notNull(),
+ description: text(),
+ iconUrl: text().notNull(),
+ href: text(),
});
export const integrationItems = sqliteTable(
"integration_item",
{
- itemId: text("item_id")
+ itemId: text()
.notNull()
.references(() => items.id, { onDelete: "cascade" }),
- integrationId: text("integration_id")
+ integrationId: text()
.notNull()
.references(() => integrations.id, { onDelete: "cascade" }),
},
@@ -351,23 +345,23 @@ export const integrationItems = sqliteTable(
);
export const icons = sqliteTable("icon", {
- id: text("icon_id").notNull().primaryKey(),
- name: text("icon_name").notNull(),
- url: text("icon_url").notNull(),
- checksum: text("icon_checksum").notNull(),
- iconRepositoryId: text("iconRepository_id")
+ id: text().notNull().primaryKey(),
+ name: text().notNull(),
+ url: text().notNull(),
+ checksum: text().notNull(),
+ iconRepositoryId: text()
.notNull()
.references(() => iconRepositories.id, { onDelete: "cascade" }),
});
export const iconRepositories = sqliteTable("iconRepository", {
- id: text("iconRepository_id").notNull().primaryKey(),
- slug: text("iconRepository_slug").notNull(),
+ id: text().notNull().primaryKey(),
+ slug: text().notNull(),
});
export const serverSettings = sqliteTable("serverSetting", {
- settingKey: text("key").notNull().unique().primaryKey(),
- value: text("value").default('{"json": {}}').notNull(), // empty superjson object
+ settingKey: text().notNull().unique().primaryKey(),
+ value: text().default('{"json": {}}').notNull(), // empty superjson object
});
export const apiKeyRelations = relations(apiKeys, ({ one }) => ({
@@ -378,14 +372,14 @@ export const apiKeyRelations = relations(apiKeys, ({ one }) => ({
}));
export const searchEngines = sqliteTable("search_engine", {
- id: text("id").notNull().primaryKey(),
- iconUrl: text("icon_url").notNull(),
- name: text("name").notNull(),
- short: text("short").notNull(),
- description: text("description"),
- urlTemplate: text("url_template"),
- type: text("type").$type<SearchEngineType>().notNull().default("generic"),
- integrationId: text("integration_id").references(() => integrations.id, { onDelete: "cascade" }),
+ id: text().notNull().primaryKey(),
+ iconUrl: text().notNull(),
+ name: text().notNull(),
+ short: text().notNull(),
+ description: text(),
+ urlTemplate: text(),
+ type: text().$type<SearchEngineType>().notNull().default("generic"),
+ integrationId: text().references(() => integrations.id, { onDelete: "cascade" }),
});
export const accountRelations = relations(accounts, ({ one }) => ({
diff --git a/packages/db/test/db-mock.ts b/packages/db/test/db-mock.ts
index d2befdfb9..e2f249554 100644
--- a/packages/db/test/db-mock.ts
+++ b/packages/db/test/db-mock.ts
@@ -6,7 +6,7 @@ import { schema } from "..";
export const createDb = (debug?: boolean) => {
const sqlite = new Database(":memory:");
- const db = drizzle(sqlite, { schema, logger: debug });
+ const db = drizzle(sqlite, { schema, logger: debug, casing: "snake_case" });
migrate(db, {
migrationsFolder: "./packages/db/migrations/sqlite",
});
diff --git a/packages/db/test/mysql-migration.spec.ts b/packages/db/test/mysql-migration.spec.ts
index d7dad22d0..3258df726 100644
--- a/packages/db/test/mysql-migration.spec.ts
+++ b/packages/db/test/mysql-migration.spec.ts
@@ -22,6 +22,7 @@ describe("Mysql Migration", () => {
const database = drizzle(connection, {
schema: mysqlSchema,
mode: "default",
+ casing: "snake_case",
});
// Run migrations and check if it works