diff --git a/app/client/modules/settings/components/sso/sso-settings-section.tsx b/app/client/modules/settings/components/sso/sso-settings-section.tsx index 8b0f4256..b028c481 100644 --- a/app/client/modules/settings/components/sso/sso-settings-section.tsx +++ b/app/client/modules/settings/components/sso/sso-settings-section.tsx @@ -27,7 +27,6 @@ import { Label } from "~/client/components/ui/label"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "~/client/components/ui/select"; import { Switch } from "~/client/components/ui/switch"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "~/client/components/ui/table"; -import { parseError } from "~/client/lib/errors"; import { useOrganizationContext } from "~/client/hooks/use-org-context"; import { formatDateWithMonth } from "~/client/lib/datetime"; import { getOrigin } from "~/client/functions/get-origin"; @@ -56,9 +55,7 @@ export function SsoSettingsSection() { toast.success(v.body?.enabled ? "Automatic account linking enabled" : "Automatic account linking disabled"); }, onError: (error) => { - toast.error("Failed to update provider", { - description: parseError(error)?.message, - }); + toast.error("Failed to update provider", { description: error.message }); }, }); @@ -68,7 +65,7 @@ export function SsoSettingsSection() { toast.success("SSO provider deleted"); }, onError: (error) => { - toast.error("Failed to delete provider", { description: parseError(error)?.message }); + toast.error("Failed to delete provider", { description: error.message }); }, }); @@ -98,8 +95,8 @@ export function SsoSettingsSection() { setInviteEmail(""); setInviteRole("member"); }, - onError: (error: unknown) => { - toast.error("Failed to create invitation", { description: parseError(error)?.message }); + onError: (error) => { + toast.error("Failed to create invitation", { description: error.message }); }, }); @@ -113,8 +110,8 @@ export function SsoSettingsSection() { onSuccess: () => { toast.success("Invitation cancelled"); }, - onError: (error: unknown) => { - toast.error("Failed to cancel invitation", { description: parseError(error)?.message }); + onError: (error) => { + toast.error("Failed to cancel invitation", { description: error.message }); }, }); @@ -124,7 +121,7 @@ export function SsoSettingsSection() { toast.success("Invitation deleted"); }, onError: (error) => { - toast.error("Failed to delete invitation", { description: parseError(error)?.message }); + toast.error("Failed to delete invitation", { description: error.message }); }, }); diff --git a/app/client/modules/settings/routes/create-sso-provider.tsx b/app/client/modules/settings/routes/create-sso-provider.tsx index d36b6973..0f571253 100644 --- a/app/client/modules/settings/routes/create-sso-provider.tsx +++ b/app/client/modules/settings/routes/create-sso-provider.tsx @@ -90,8 +90,8 @@ export function CreateSsoProviderPage() { toast.success("SSO provider registered successfully"); void navigate({ to: "/settings", search: { tab: "users" } }); }, - onError: (error: unknown) => { - toast.error("Failed to register provider", { description: parseError(error)?.message }); + onError: (error) => { + toast.error("Failed to register provider", { description: error.message }); }, }); diff --git a/app/drizzle/20260214144113_mighty_meggan/snapshot.json b/app/drizzle/20260214144113_mighty_meggan/snapshot.json deleted file mode 100644 index 2b67103b..00000000 --- a/app/drizzle/20260214144113_mighty_meggan/snapshot.json +++ /dev/null @@ -1,2210 +0,0 @@ -{ - "version": "7", - "dialect": "sqlite", - "id": "ab028cd7-c0cb-44f4-843b-37e95ab3c667", - "prevIds": ["3a308c54-d950-464f-9490-fee06985fbeb"], - "ddl": [ - { - "name": "account", - "entityType": "tables" - }, - { - "name": "app_metadata", - "entityType": "tables" - }, - { - "name": "backup_schedule_mirrors_table", - "entityType": "tables" - }, - { - "name": "backup_schedule_notifications_table", - "entityType": "tables" - }, - { - "name": "backup_schedules_table", - "entityType": "tables" - }, - { - "name": "invitation", - "entityType": "tables" - }, - { - "name": "member", - "entityType": "tables" - }, - { - "name": "notification_destinations_table", - "entityType": "tables" - }, - { - "name": "organization", - "entityType": "tables" - }, - { - "name": "repositories_table", - "entityType": "tables" - }, - { - "name": "sessions_table", - "entityType": "tables" - }, - { - "name": "sso_provider", - "entityType": "tables" - }, - { - "name": "two_factor", - "entityType": "tables" - }, - { - "name": "users_table", - "entityType": "tables" - }, - { - "name": "verification", - "entityType": "tables" - }, - { - "name": "volumes_table", - "entityType": "tables" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "account_id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "provider_id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "user_id", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id_token", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "access_token_expires_at", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "refresh_token_expires_at", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "scope", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "password", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "created_at", - "entityType": "columns", - "table": "account" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "updated_at", - "entityType": "columns", - "table": "account" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "key", - "entityType": "columns", - "table": "app_metadata" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "value", - "entityType": "columns", - "table": "app_metadata" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "created_at", - "entityType": "columns", - "table": "app_metadata" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "updated_at", - "entityType": "columns", - "table": "app_metadata" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": true, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "backup_schedule_mirrors_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "schedule_id", - "entityType": "columns", - "table": "backup_schedule_mirrors_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "repository_id", - "entityType": "columns", - "table": "backup_schedule_mirrors_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "true", - "generated": null, - "name": "enabled", - "entityType": "columns", - "table": "backup_schedule_mirrors_table" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "last_copy_at", - "entityType": "columns", - "table": "backup_schedule_mirrors_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "last_copy_status", - "entityType": "columns", - "table": "backup_schedule_mirrors_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "last_copy_error", - "entityType": "columns", - "table": "backup_schedule_mirrors_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "created_at", - "entityType": "columns", - "table": "backup_schedule_mirrors_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "schedule_id", - "entityType": "columns", - "table": "backup_schedule_notifications_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "destination_id", - "entityType": "columns", - "table": "backup_schedule_notifications_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "false", - "generated": null, - "name": "notify_on_start", - "entityType": "columns", - "table": "backup_schedule_notifications_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "false", - "generated": null, - "name": "notify_on_success", - "entityType": "columns", - "table": "backup_schedule_notifications_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "true", - "generated": null, - "name": "notify_on_warning", - "entityType": "columns", - "table": "backup_schedule_notifications_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "true", - "generated": null, - "name": "notify_on_failure", - "entityType": "columns", - "table": "backup_schedule_notifications_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "created_at", - "entityType": "columns", - "table": "backup_schedule_notifications_table" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": true, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "short_id", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "volume_id", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "repository_id", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "true", - "generated": null, - "name": "enabled", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "cron_expression", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "retention_policy", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": "'[]'", - "generated": null, - "name": "exclude_patterns", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": "'[]'", - "generated": null, - "name": "exclude_if_present", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": "'[]'", - "generated": null, - "name": "include_patterns", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "last_backup_at", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "last_backup_status", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "last_backup_error", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "next_backup_at", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "false", - "generated": null, - "name": "one_file_system", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "0", - "generated": null, - "name": "sort_order", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "created_at", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "updated_at", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "organization_id", - "entityType": "columns", - "table": "backup_schedules_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "invitation" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "organization_id", - "entityType": "columns", - "table": "invitation" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "invitation" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "role", - "entityType": "columns", - "table": "invitation" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "'pending'", - "generated": null, - "name": "status", - "entityType": "columns", - "table": "invitation" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "expires_at", - "entityType": "columns", - "table": "invitation" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "created_at", - "entityType": "columns", - "table": "invitation" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "inviter_id", - "entityType": "columns", - "table": "invitation" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "member" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "organization_id", - "entityType": "columns", - "table": "member" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "user_id", - "entityType": "columns", - "table": "member" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "'member'", - "generated": null, - "name": "role", - "entityType": "columns", - "table": "member" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "created_at", - "entityType": "columns", - "table": "member" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": true, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "notification_destinations_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "notification_destinations_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "true", - "generated": null, - "name": "enabled", - "entityType": "columns", - "table": "notification_destinations_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "notification_destinations_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "config", - "entityType": "columns", - "table": "notification_destinations_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "created_at", - "entityType": "columns", - "table": "notification_destinations_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "updated_at", - "entityType": "columns", - "table": "notification_destinations_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "organization_id", - "entityType": "columns", - "table": "notification_destinations_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "organization" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "organization" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "slug", - "entityType": "columns", - "table": "organization" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "logo", - "entityType": "columns", - "table": "organization" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "created_at", - "entityType": "columns", - "table": "organization" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "metadata", - "entityType": "columns", - "table": "organization" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "repositories_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "short_id", - "entityType": "columns", - "table": "repositories_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "repositories_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "repositories_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "config", - "entityType": "columns", - "table": "repositories_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": "'auto'", - "generated": null, - "name": "compression_mode", - "entityType": "columns", - "table": "repositories_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": "'unknown'", - "generated": null, - "name": "status", - "entityType": "columns", - "table": "repositories_table" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "last_checked", - "entityType": "columns", - "table": "repositories_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "last_error", - "entityType": "columns", - "table": "repositories_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "doctor_result", - "entityType": "columns", - "table": "repositories_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "false", - "generated": null, - "name": "upload_limit_enabled", - "entityType": "columns", - "table": "repositories_table" - }, - { - "type": "real", - "notNull": true, - "autoincrement": false, - "default": "1", - "generated": null, - "name": "upload_limit_value", - "entityType": "columns", - "table": "repositories_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "'Mbps'", - "generated": null, - "name": "upload_limit_unit", - "entityType": "columns", - "table": "repositories_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "false", - "generated": null, - "name": "download_limit_enabled", - "entityType": "columns", - "table": "repositories_table" - }, - { - "type": "real", - "notNull": true, - "autoincrement": false, - "default": "1", - "generated": null, - "name": "download_limit_value", - "entityType": "columns", - "table": "repositories_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "'Mbps'", - "generated": null, - "name": "download_limit_unit", - "entityType": "columns", - "table": "repositories_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "created_at", - "entityType": "columns", - "table": "repositories_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "updated_at", - "entityType": "columns", - "table": "repositories_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "organization_id", - "entityType": "columns", - "table": "repositories_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "sessions_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "user_id", - "entityType": "columns", - "table": "sessions_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "token", - "entityType": "columns", - "table": "sessions_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "expires_at", - "entityType": "columns", - "table": "sessions_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "created_at", - "entityType": "columns", - "table": "sessions_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "updated_at", - "entityType": "columns", - "table": "sessions_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "ip_address", - "entityType": "columns", - "table": "sessions_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "user_agent", - "entityType": "columns", - "table": "sessions_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "impersonated_by", - "entityType": "columns", - "table": "sessions_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "active_organization_id", - "entityType": "columns", - "table": "sessions_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "sso_provider" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "provider_id", - "entityType": "columns", - "table": "sso_provider" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "organization_id", - "entityType": "columns", - "table": "sso_provider" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "user_id", - "entityType": "columns", - "table": "sso_provider" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "issuer", - "entityType": "columns", - "table": "sso_provider" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "domain", - "entityType": "columns", - "table": "sso_provider" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "oidc_config", - "entityType": "columns", - "table": "sso_provider" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "saml_config", - "entityType": "columns", - "table": "sso_provider" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "created_at", - "entityType": "columns", - "table": "sso_provider" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "updated_at", - "entityType": "columns", - "table": "sso_provider" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "two_factor" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "secret", - "entityType": "columns", - "table": "two_factor" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "backup_codes", - "entityType": "columns", - "table": "two_factor" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "user_id", - "entityType": "columns", - "table": "two_factor" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "users_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "username", - "entityType": "columns", - "table": "users_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "password_hash", - "entityType": "columns", - "table": "users_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "false", - "generated": null, - "name": "has_downloaded_restic_password", - "entityType": "columns", - "table": "users_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "created_at", - "entityType": "columns", - "table": "users_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "updated_at", - "entityType": "columns", - "table": "users_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "users_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "email", - "entityType": "columns", - "table": "users_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "false", - "generated": null, - "name": "email_verified", - "entityType": "columns", - "table": "users_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "image", - "entityType": "columns", - "table": "users_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "display_username", - "entityType": "columns", - "table": "users_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "false", - "generated": null, - "name": "two_factor_enabled", - "entityType": "columns", - "table": "users_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "'user'", - "generated": null, - "name": "role", - "entityType": "columns", - "table": "users_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "false", - "generated": null, - "name": "banned", - "entityType": "columns", - "table": "users_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "ban_reason", - "entityType": "columns", - "table": "users_table" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "ban_expires", - "entityType": "columns", - "table": "users_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "verification" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "identifier", - "entityType": "columns", - "table": "verification" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "value", - "entityType": "columns", - "table": "verification" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "expires_at", - "entityType": "columns", - "table": "verification" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "created_at", - "entityType": "columns", - "table": "verification" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "updated_at", - "entityType": "columns", - "table": "verification" - }, - { - "type": "integer", - "notNull": false, - "autoincrement": true, - "default": null, - "generated": null, - "name": "id", - "entityType": "columns", - "table": "volumes_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "short_id", - "entityType": "columns", - "table": "volumes_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "name", - "entityType": "columns", - "table": "volumes_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "type", - "entityType": "columns", - "table": "volumes_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": "'unmounted'", - "generated": null, - "name": "status", - "entityType": "columns", - "table": "volumes_table" - }, - { - "type": "text", - "notNull": false, - "autoincrement": false, - "default": null, - "generated": null, - "name": "last_error", - "entityType": "columns", - "table": "volumes_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "last_health_check", - "entityType": "columns", - "table": "volumes_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "created_at", - "entityType": "columns", - "table": "volumes_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "(unixepoch() * 1000)", - "generated": null, - "name": "updated_at", - "entityType": "columns", - "table": "volumes_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "config", - "entityType": "columns", - "table": "volumes_table" - }, - { - "type": "integer", - "notNull": true, - "autoincrement": false, - "default": "true", - "generated": null, - "name": "auto_remount", - "entityType": "columns", - "table": "volumes_table" - }, - { - "type": "text", - "notNull": true, - "autoincrement": false, - "default": null, - "generated": null, - "name": "organization_id", - "entityType": "columns", - "table": "volumes_table" - }, - { - "columns": ["user_id"], - "tableTo": "users_table", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "account_user_id_users_table_id_fk", - "entityType": "fks", - "table": "account" - }, - { - "columns": ["schedule_id"], - "tableTo": "backup_schedules_table", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "backup_schedule_mirrors_table_schedule_id_backup_schedules_table_id_fk", - "entityType": "fks", - "table": "backup_schedule_mirrors_table" - }, - { - "columns": ["repository_id"], - "tableTo": "repositories_table", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "backup_schedule_mirrors_table_repository_id_repositories_table_id_fk", - "entityType": "fks", - "table": "backup_schedule_mirrors_table" - }, - { - "columns": ["schedule_id"], - "tableTo": "backup_schedules_table", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "backup_schedule_notifications_table_schedule_id_backup_schedules_table_id_fk", - "entityType": "fks", - "table": "backup_schedule_notifications_table" - }, - { - "columns": ["destination_id"], - "tableTo": "notification_destinations_table", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "backup_schedule_notifications_table_destination_id_notification_destinations_table_id_fk", - "entityType": "fks", - "table": "backup_schedule_notifications_table" - }, - { - "columns": ["volume_id"], - "tableTo": "volumes_table", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "backup_schedules_table_volume_id_volumes_table_id_fk", - "entityType": "fks", - "table": "backup_schedules_table" - }, - { - "columns": ["repository_id"], - "tableTo": "repositories_table", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "backup_schedules_table_repository_id_repositories_table_id_fk", - "entityType": "fks", - "table": "backup_schedules_table" - }, - { - "columns": ["organization_id"], - "tableTo": "organization", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "backup_schedules_table_organization_id_organization_id_fk", - "entityType": "fks", - "table": "backup_schedules_table" - }, - { - "columns": ["organization_id"], - "tableTo": "organization", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "invitation_organization_id_organization_id_fk", - "entityType": "fks", - "table": "invitation" - }, - { - "columns": ["inviter_id"], - "tableTo": "users_table", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "invitation_inviter_id_users_table_id_fk", - "entityType": "fks", - "table": "invitation" - }, - { - "columns": ["organization_id"], - "tableTo": "organization", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "member_organization_id_organization_id_fk", - "entityType": "fks", - "table": "member" - }, - { - "columns": ["user_id"], - "tableTo": "users_table", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "member_user_id_users_table_id_fk", - "entityType": "fks", - "table": "member" - }, - { - "columns": ["organization_id"], - "tableTo": "organization", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "notification_destinations_table_organization_id_organization_id_fk", - "entityType": "fks", - "table": "notification_destinations_table" - }, - { - "columns": ["organization_id"], - "tableTo": "organization", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "repositories_table_organization_id_organization_id_fk", - "entityType": "fks", - "table": "repositories_table" - }, - { - "columns": ["user_id"], - "tableTo": "users_table", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "sessions_table_user_id_users_table_id_fk", - "entityType": "fks", - "table": "sessions_table" - }, - { - "columns": ["organization_id"], - "tableTo": "organization", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_sso_provider_organization_id_organization_id_fk", - "entityType": "fks", - "table": "sso_provider" - }, - { - "columns": ["user_id"], - "tableTo": "users_table", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "fk_sso_provider_user_id_users_table_id_fk", - "entityType": "fks", - "table": "sso_provider" - }, - { - "columns": ["user_id"], - "tableTo": "users_table", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "two_factor_user_id_users_table_id_fk", - "entityType": "fks", - "table": "two_factor" - }, - { - "columns": ["organization_id"], - "tableTo": "organization", - "columnsTo": ["id"], - "onUpdate": "NO ACTION", - "onDelete": "CASCADE", - "nameExplicit": false, - "name": "volumes_table_organization_id_organization_id_fk", - "entityType": "fks", - "table": "volumes_table" - }, - { - "columns": ["schedule_id", "destination_id"], - "nameExplicit": false, - "name": "backup_schedule_notifications_table_schedule_id_destination_id_pk", - "entityType": "pks", - "table": "backup_schedule_notifications_table" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "account_pk", - "table": "account", - "entityType": "pks" - }, - { - "columns": ["key"], - "nameExplicit": false, - "name": "app_metadata_pk", - "table": "app_metadata", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "backup_schedule_mirrors_table_pk", - "table": "backup_schedule_mirrors_table", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "backup_schedules_table_pk", - "table": "backup_schedules_table", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "invitation_pk", - "table": "invitation", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "member_pk", - "table": "member", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "notification_destinations_table_pk", - "table": "notification_destinations_table", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "organization_pk", - "table": "organization", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "repositories_table_pk", - "table": "repositories_table", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "sessions_table_pk", - "table": "sessions_table", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "sso_provider_pk", - "table": "sso_provider", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "two_factor_pk", - "table": "two_factor", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "users_table_pk", - "table": "users_table", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "verification_pk", - "table": "verification", - "entityType": "pks" - }, - { - "columns": ["id"], - "nameExplicit": false, - "name": "volumes_table_pk", - "table": "volumes_table", - "entityType": "pks" - }, - { - "columns": [ - { - "value": "user_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "account_userId_idx", - "entityType": "indexes", - "table": "account" - }, - { - "columns": [ - { - "value": "organization_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "invitation_organizationId_idx", - "entityType": "indexes", - "table": "invitation" - }, - { - "columns": [ - { - "value": "email", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "invitation_email_idx", - "entityType": "indexes", - "table": "invitation" - }, - { - "columns": [ - { - "value": "organization_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "member_organizationId_idx", - "entityType": "indexes", - "table": "member" - }, - { - "columns": [ - { - "value": "user_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "member_userId_idx", - "entityType": "indexes", - "table": "member" - }, - { - "columns": [ - { - "value": "organization_id", - "isExpression": false - }, - { - "value": "user_id", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "member_org_user_uidx", - "entityType": "indexes", - "table": "member" - }, - { - "columns": [ - { - "value": "slug", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "organization_slug_uidx", - "entityType": "indexes", - "table": "organization" - }, - { - "columns": [ - { - "value": "user_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "sessionsTable_userId_idx", - "entityType": "indexes", - "table": "sessions_table" - }, - { - "columns": [ - { - "value": "provider_id", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "sso_provider_provider_id_uidx", - "entityType": "indexes", - "table": "sso_provider" - }, - { - "columns": [ - { - "value": "organization_id", - "isExpression": false - } - ], - "isUnique": true, - "where": null, - "origin": "manual", - "name": "sso_provider_organization_id_uidx", - "entityType": "indexes", - "table": "sso_provider" - }, - { - "columns": [ - { - "value": "domain", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "sso_provider_domain_idx", - "entityType": "indexes", - "table": "sso_provider" - }, - { - "columns": [ - { - "value": "secret", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "twoFactor_secret_idx", - "entityType": "indexes", - "table": "two_factor" - }, - { - "columns": [ - { - "value": "user_id", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "twoFactor_userId_idx", - "entityType": "indexes", - "table": "two_factor" - }, - { - "columns": [ - { - "value": "identifier", - "isExpression": false - } - ], - "isUnique": false, - "where": null, - "origin": "manual", - "name": "verification_identifier_idx", - "entityType": "indexes", - "table": "verification" - }, - { - "columns": ["schedule_id", "repository_id"], - "nameExplicit": false, - "name": "backup_schedule_mirrors_table_schedule_id_repository_id_unique", - "entityType": "uniques", - "table": "backup_schedule_mirrors_table" - }, - { - "columns": ["name", "organization_id"], - "nameExplicit": false, - "name": "volumes_table_name_organization_id_unique", - "entityType": "uniques", - "table": "volumes_table" - }, - { - "columns": ["short_id"], - "nameExplicit": false, - "name": "backup_schedules_table_short_id_unique", - "entityType": "uniques", - "table": "backup_schedules_table" - }, - { - "columns": ["short_id"], - "nameExplicit": false, - "name": "repositories_table_short_id_unique", - "entityType": "uniques", - "table": "repositories_table" - }, - { - "columns": ["token"], - "nameExplicit": false, - "name": "sessions_table_token_unique", - "entityType": "uniques", - "table": "sessions_table" - }, - { - "columns": ["username"], - "nameExplicit": false, - "name": "users_table_username_unique", - "entityType": "uniques", - "table": "users_table" - }, - { - "columns": ["email"], - "nameExplicit": false, - "name": "users_table_email_unique", - "entityType": "uniques", - "table": "users_table" - }, - { - "columns": ["short_id"], - "nameExplicit": false, - "name": "volumes_table_short_id_unique", - "entityType": "uniques", - "table": "volumes_table" - } - ], - "renames": [] -} diff --git a/app/drizzle/20260222184329_lonely_blacklash/migration.sql b/app/drizzle/20260222184329_lonely_blacklash/migration.sql deleted file mode 100644 index a94d63a1..00000000 --- a/app/drizzle/20260222184329_lonely_blacklash/migration.sql +++ /dev/null @@ -1,25 +0,0 @@ -ALTER TABLE `sso_provider` ADD `auto_link_matching_emails` integer DEFAULT true NOT NULL;--> statement-breakpoint -PRAGMA foreign_keys=OFF;--> statement-breakpoint -CREATE TABLE `__new_sso_provider` ( - `id` text PRIMARY KEY, - `provider_id` text NOT NULL, - `organization_id` text NOT NULL, - `user_id` text, - `issuer` text NOT NULL, - `domain` text NOT NULL, - `auto_link_matching_emails` integer DEFAULT true NOT NULL, - `oidc_config` text, - `saml_config` text, - `created_at` integer DEFAULT (unixepoch() * 1000) NOT NULL, - `updated_at` integer DEFAULT (unixepoch() * 1000) NOT NULL, - CONSTRAINT `fk_sso_provider_organization_id_organization_id_fk` FOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_sso_provider_user_id_users_table_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users_table`(`id`) ON DELETE SET NULL -); ---> statement-breakpoint -INSERT INTO `__new_sso_provider`(`id`, `provider_id`, `organization_id`, `user_id`, `issuer`, `domain`, `oidc_config`, `saml_config`, `created_at`, `updated_at`) SELECT `id`, `provider_id`, `organization_id`, `user_id`, `issuer`, `domain`, `oidc_config`, `saml_config`, `created_at`, `updated_at` FROM `sso_provider`;--> statement-breakpoint -DROP TABLE `sso_provider`;--> statement-breakpoint -ALTER TABLE `__new_sso_provider` RENAME TO `sso_provider`;--> statement-breakpoint -PRAGMA foreign_keys=ON;--> statement-breakpoint -CREATE UNIQUE INDEX `sso_provider_provider_id_uidx` ON `sso_provider` (`provider_id`);--> statement-breakpoint -CREATE UNIQUE INDEX `sso_provider_organization_id_uidx` ON `sso_provider` (`organization_id`);--> statement-breakpoint -CREATE INDEX `sso_provider_domain_idx` ON `sso_provider` (`domain`); \ No newline at end of file diff --git a/app/drizzle/20260214144113_mighty_meggan/migration.sql b/app/drizzle/20260223194752_thin_white_tiger/migration.sql similarity index 85% rename from app/drizzle/20260214144113_mighty_meggan/migration.sql rename to app/drizzle/20260223194752_thin_white_tiger/migration.sql index a4e44bf3..b1c91f4a 100644 --- a/app/drizzle/20260214144113_mighty_meggan/migration.sql +++ b/app/drizzle/20260223194752_thin_white_tiger/migration.sql @@ -2,15 +2,16 @@ CREATE TABLE `sso_provider` ( `id` text PRIMARY KEY, `provider_id` text NOT NULL, `organization_id` text NOT NULL, - `user_id` text NOT NULL, + `user_id` text, `issuer` text NOT NULL, `domain` text NOT NULL, + `auto_link_matching_emails` integer DEFAULT false NOT NULL, `oidc_config` text, `saml_config` text, `created_at` integer DEFAULT (unixepoch() * 1000) NOT NULL, `updated_at` integer DEFAULT (unixepoch() * 1000) NOT NULL, CONSTRAINT `fk_sso_provider_organization_id_organization_id_fk` FOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON DELETE CASCADE, - CONSTRAINT `fk_sso_provider_user_id_users_table_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users_table`(`id`) ON DELETE CASCADE + CONSTRAINT `fk_sso_provider_user_id_users_table_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users_table`(`id`) ON DELETE SET NULL ); --> statement-breakpoint CREATE UNIQUE INDEX `sso_provider_provider_id_uidx` ON `sso_provider` (`provider_id`);--> statement-breakpoint diff --git a/app/drizzle/20260222184329_lonely_blacklash/snapshot.json b/app/drizzle/20260223194752_thin_white_tiger/snapshot.json similarity index 99% rename from app/drizzle/20260222184329_lonely_blacklash/snapshot.json rename to app/drizzle/20260223194752_thin_white_tiger/snapshot.json index 3651a03c..4bd0c08e 100644 --- a/app/drizzle/20260222184329_lonely_blacklash/snapshot.json +++ b/app/drizzle/20260223194752_thin_white_tiger/snapshot.json @@ -1,8 +1,8 @@ { "version": "7", "dialect": "sqlite", - "id": "93504601-a3b2-4f09-92ca-16f132bcdd3a", - "prevIds": ["ab028cd7-c0cb-44f4-843b-37e95ab3c667"], + "id": "f1d1baed-4d81-40b5-86fb-56e9c173a27f", + "prevIds": ["3a308c54-d950-464f-9490-fee06985fbeb"], "ddl": [ { "name": "account", @@ -1212,7 +1212,7 @@ "type": "integer", "notNull": true, "autoincrement": false, - "default": "true", + "default": "false", "generated": null, "name": "auto_link_matching_emails", "entityType": "columns", diff --git a/app/server/lib/auth/helpers/create-default-org.ts b/app/server/lib/auth/helpers/create-default-org.ts index 0bde9cc4..b52496fd 100644 --- a/app/server/lib/auth/helpers/create-default-org.ts +++ b/app/server/lib/auth/helpers/create-default-org.ts @@ -27,24 +27,12 @@ function buildOrgSlug(email: string) { return `${emailPrefix}-${Math.random().toString(36).slice(-4)}`; } -async function getProviderFromContext(ctx: GenericEndpointContext | null) { - if (!ctx) { - return null; - } - - const providerId = extractProviderIdFromContext(ctx); - if (!providerId) { - return null; - } - - const provider = await db.query.ssoProvider.findFirst({ where: { providerId } }); - return provider; -} - async function tryCreateInvitedMembership(userId: string, email: string, ctx: GenericEndpointContext | null) { logger.debug("Checking for pending invitations for user", userId, email); - const ssoProvider = await getProviderFromContext(ctx); + const providerId = extractProviderIdFromContext(ctx); + const ssoProvider = await db.query.ssoProvider.findFirst({ where: { providerId } }); + if (!ssoProvider) { logger.debug("No SSO provider found in context, skipping invitation check"); return null; diff --git a/app/server/lib/auth/utils/sso-context.ts b/app/server/lib/auth/utils/sso-context.ts index ef4a8920..b691d8b6 100644 --- a/app/server/lib/auth/utils/sso-context.ts +++ b/app/server/lib/auth/utils/sso-context.ts @@ -4,7 +4,11 @@ export function normalizeEmail(email: string): string { return email.trim().toLowerCase(); } -export function extractProviderIdFromContext(ctx: GenericEndpointContext): string | null { +export function extractProviderIdFromContext(ctx?: GenericEndpointContext | null) { + if (!ctx) { + return null; + } + if (ctx.params?.providerId) { return ctx.params.providerId; } diff --git a/app/server/modules/auth/auth.dto.ts b/app/server/modules/auth/auth.dto.ts index c9d9db89..d2668c5f 100644 --- a/app/server/modules/auth/auth.dto.ts +++ b/app/server/modules/auth/auth.dto.ts @@ -9,7 +9,9 @@ export const publicSsoProvidersDto = type({ providers: type({ providerId: "string", organizationSlug: "string", - }).array(), + }) + .onUndeclaredKey("delete") + .array(), }); export type PublicSsoProvidersDto = typeof publicSsoProvidersDto.infer; diff --git a/app/server/modules/auth/auth.service.ts b/app/server/modules/auth/auth.service.ts index 5411091c..d89bc5a0 100644 --- a/app/server/modules/auth/auth.service.ts +++ b/app/server/modules/auth/auth.service.ts @@ -130,12 +130,10 @@ export class AuthService { * Update per-provider auto-linking setting */ async updateSsoProviderAutoLinking(providerId: string, enabled: boolean): Promise { - const existingProvider = await db - .select({ id: ssoProvider.id }) - .from(ssoProvider) - .where(eq(ssoProvider.providerId, providerId)) - .limit(1) - .then((result) => result[0]); + const existingProvider = await db.query.ssoProvider.findFirst({ + where: { providerId }, + columns: { id: true }, + }); if (!existingProvider) { return false; @@ -159,10 +157,10 @@ export class AuthService { async getUserAccounts(userIds: string[]): Promise> { if (userIds.length === 0) return {}; - const accounts = await db - .select({ id: account.id, providerId: account.providerId, userId: account.userId }) - .from(account) - .where(inArray(account.userId, userIds)); + const accounts = await db.query.account.findMany({ + where: { userId: { in: userIds } }, + columns: { id: true, providerId: true, userId: true }, + }); const grouped: Record = {}; for (const row of accounts) { @@ -178,7 +176,10 @@ export class AuthService { * Delete a single account for a user, refusing if it is the last one */ async deleteUserAccount(userId: string, accountId: string): Promise<{ lastAccount: boolean }> { - const userAccounts = await db.select({ id: account.id }).from(account).where(eq(account.userId, userId)); + const userAccounts = await db.query.account.findMany({ + where: { userId }, + columns: { id: true }, + }); if (userAccounts.length <= 1) { return { lastAccount: true };