🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Refactor team selection in InviteMemberDialog component
Bill Yang071eb10e1584
diff --git a/client/messages/cs.json b/client/messages/cs.jsonindex 2a7458028..a58ac5a37 100644--- a/client/messages/cs.json+++ b/client/messages/cs.json@@ -805,9 +805,9 @@"lXZjmr": "","B3uRNN": "","cEIr3W": "",- "DNeuzb": "",- "wMcv1G": "",- "OtSSs+": "",+ "wsUmh9": "",+ "zUJjPA": "",+ "WdvGbR": "","ptwP96": "","hYOE+U": "","x8CB7X": "",@@ -835,6 +835,7 @@"i7B/4+": "","O8Sc7E": "","l8wanU": "",+ "OtSSs+": "","iv7EVe": "","qrWOxx": "","Q5kEny": "",@@ -864,6 +865,7 @@"iSNlf0": "","oSW2J5": "","+WnNru": "",+ "DNeuzb": "","f7uwif": "","cPbI/I": "","xA1LY9": "",diff --git a/client/messages/de.json b/client/messages/de.jsonindex 7b32283fd..8c12c1a00 100644--- a/client/messages/de.json+++ b/client/messages/de.json@@ -805,9 +805,9 @@"lXZjmr": "Laden Sie ein neues Mitglied zu dieser Organisation ein.","B3uRNN": "Zugriff auf bestimmte Websites einschränken","cEIr3W": "Dieses Mitglied hat nur Zugriff auf die ausgewählten Websites.",- "DNeuzb": "Teams",- "wMcv1G": "Optional dieses Mitglied zu Teams hinzufügen, wenn es die Einladung annimmt.",- "OtSSs+": "{count} Websites",+ "wsUmh9": "",+ "zUJjPA": "",+ "WdvGbR": "","ptwP96": "Wird eingeladen...","hYOE+U": "Einladen","x8CB7X": "Website-Zugriff erfolgreich aktualisiert",@@ -835,6 +835,7 @@"i7B/4+": "Diese Organisation und alle zugehörigen Daten dauerhaft löschen","O8Sc7E": "Website-Zugriff","l8wanU": "Beigetreten",+ "OtSSs+": "{count} Websites","iv7EVe": "Alle Websites","qrWOxx": "Keine Mitglieder gefunden","Q5kEny": "Organisation wird geladen...",@@ -864,6 +865,7 @@"iSNlf0": "Team konnte nicht gelöscht werden","oSW2J5": "Team löschen","+WnNru": "Sind Sie sicher, dass Sie das Team \"{name}\" löschen möchten? Websites, die diesem Team zugewiesen sind, werden nicht mehr zugewiesen und für alle Mitglieder sichtbar.",+ "DNeuzb": "Teams","f7uwif": "Organisieren Sie Websites in Teams, um zu steuern, welche Mitglieder darauf zugreifen können.","cPbI/I": "Sie haben keine Berechtigung, die Teameinstellungen anzuzeigen.","xA1LY9": "Sie müssen eine Organisation erstellen oder zu einer hinzugefügt werden, bevor Sie Teams verwalten können.",diff --git a/client/messages/en.json b/client/messages/en.jsonindex 682439126..9a53a4e67 100644--- a/client/messages/en.json+++ b/client/messages/en.json@@ -805,9 +805,9 @@"lXZjmr": "Invite a new member to this organization.","B3uRNN": "Restrict access to specific sites","cEIr3W": "This member will only have access to the selected sites.",- "DNeuzb": "Teams",- "wMcv1G": "Optionally add this member to teams when they accept the invitation.",- "OtSSs+": "{count} sites",+ "wsUmh9": "Team",+ "zUJjPA": "No team",+ "WdvGbR": "Optionally add this member to a team when they accept the invitation.","ptwP96": "Inviting...","hYOE+U": "Invite","x8CB7X": "Site access updated successfully",@@ -835,6 +835,7 @@"i7B/4+": "Permanently delete this organization and all its data","O8Sc7E": "Site Access","l8wanU": "Joined",+ "OtSSs+": "{count} sites","iv7EVe": "All sites","qrWOxx": "No members found","Q5kEny": "Loading organization...",@@ -864,6 +865,7 @@"iSNlf0": "Failed to delete team","oSW2J5": "Delete Team","+WnNru": "Are you sure you want to delete the team \"{name}\"? Sites assigned to this team will become unassigned and visible to all members.",+ "DNeuzb": "Teams","f7uwif": "Organize sites into teams to control which members can access them.","cPbI/I": "You don't have permission to view team settings.","xA1LY9": "You need to create or be added to an organization before you can manage teams.",diff --git a/client/messages/es.json b/client/messages/es.jsonindex 1f35f11c2..5b75fa98d 100644--- a/client/messages/es.json+++ b/client/messages/es.json@@ -805,9 +805,9 @@"lXZjmr": "Invita a un nuevo miembro a esta organización.","B3uRNN": "Restringir acceso a sitios específicos","cEIr3W": "Este miembro solo tendrá acceso a los sitios seleccionados.",- "DNeuzb": "Equipos",- "wMcv1G": "Opcionalmente, agrega este miembro a equipos cuando acepte la invitación.",- "OtSSs+": "{count} sitios",+ "wsUmh9": "",+ "zUJjPA": "",+ "WdvGbR": "","ptwP96": "Invitando...","hYOE+U": "Invitar","x8CB7X": "Acceso al sitio actualizado correctamente",@@ -835,6 +835,7 @@"i7B/4+": "Elimina permanentemente esta organización y todos sus datos","O8Sc7E": "Acceso al sitio","l8wanU": "Unido",+ "OtSSs+": "{count} sitios","iv7EVe": "Todos los sitios","qrWOxx": "No se encontraron miembros","Q5kEny": "Cargando organización...",@@ -864,6 +865,7 @@"iSNlf0": "Error al eliminar el equipo","oSW2J5": "Eliminar equipo","+WnNru": "¿Estás seguro de que quieres eliminar el equipo \"{name}\"? Los sitios asignados a este equipo quedarán sin asignar y serán visibles para todos los miembros.",+ "DNeuzb": "Equipos","f7uwif": "Organiza los sitios en equipos para controlar qué miembros pueden acceder a ellos.","cPbI/I": "No tienes permiso para ver la configuración del equipo.","xA1LY9": "Debes crear o ser agregado a una organización antes de poder administrar equipos.",diff --git a/client/messages/fr.json b/client/messages/fr.jsonindex f74574e78..9ce75be17 100644--- a/client/messages/fr.json+++ b/client/messages/fr.json@@ -805,9 +805,9 @@"lXZjmr": "Invitez un nouveau membre dans cette organisation.","B3uRNN": "Restreindre l'accès à des sites spécifiques","cEIr3W": "Ce membre n'aura accès qu'aux sites sélectionnés.",- "DNeuzb": "Équipes",- "wMcv1G": "Ajoutez éventuellement ce membre à des équipes lorsqu'il accepte l'invitation.",- "OtSSs+": "{count} sites",+ "wsUmh9": "",+ "zUJjPA": "",+ "WdvGbR": "","ptwP96": "Invitation en cours...","hYOE+U": "Inviter","x8CB7X": "Accès au site mis à jour avec succès",@@ -835,6 +835,7 @@"i7B/4+": "Supprimer définitivement cette organisation et toutes ses données","O8Sc7E": "Accès au site","l8wanU": "Rejoint",+ "OtSSs+": "{count} sites","iv7EVe": "Tous les sites","qrWOxx": "Aucun membre trouvé","Q5kEny": "Chargement de l'organisation...",@@ -864,6 +865,7 @@"iSNlf0": "Échec de la suppression de l'équipe","oSW2J5": "Supprimer l'équipe","+WnNru": "Êtes-vous sûr de vouloir supprimer l'équipe \"{name}\" ? Les sites affectés à cette équipe deviendront non affectés et visibles pour tous les membres.",+ "DNeuzb": "Équipes","f7uwif": "Organisez les sites en équipes pour contrôler quels membres peuvent y accéder.","cPbI/I": "Vous n'avez pas l'autorisation de consulter les paramètres de l'équipe.","xA1LY9": "Vous devez créer ou être ajouté à une organisation avant de pouvoir gérer les équipes.",diff --git a/client/messages/it.json b/client/messages/it.jsonindex 1c5b5653e..854070b81 100644--- a/client/messages/it.json+++ b/client/messages/it.json@@ -805,9 +805,9 @@"lXZjmr": "Invita un nuovo membro in questa organizzazione.","B3uRNN": "Limita l'accesso a siti specifici","cEIr3W": "Questo membro avrà accesso solo ai siti selezionati.",- "DNeuzb": "Team",- "wMcv1G": "Facoltativamente aggiungi questo membro ai team quando accetta l'invito.",- "OtSSs+": "{count} siti",+ "wsUmh9": "",+ "zUJjPA": "",+ "WdvGbR": "","ptwP96": "Invitando...","hYOE+U": "Invita","x8CB7X": "Accesso al sito aggiornato con successo",@@ -835,6 +835,7 @@"i7B/4+": "Elimina permanentemente questa organizzazione e tutti i suoi dati","O8Sc7E": "Accesso al Sito","l8wanU": "Unito il",+ "OtSSs+": "{count} siti","iv7EVe": "Tutti i siti","qrWOxx": "Nessun membro trovato","Q5kEny": "Caricamento organizzazione...",@@ -864,6 +865,7 @@"iSNlf0": "Impossibile eliminare il team","oSW2J5": "Elimina team","+WnNru": "Sei sicuro di voler eliminare il team \"{name}\"? I siti assegnati a questo team diventeranno non assegnati e visibili a tutti i membri.",+ "DNeuzb": "Team","f7uwif": "Organizza i siti in team per controllare quali membri possono accedervi.","cPbI/I": "Non hai il permesso di visualizzare le impostazioni del team.","xA1LY9": "Devi creare o essere aggiunto a un'organizzazione prima di poter gestire i team.",diff --git a/client/messages/ja.json b/client/messages/ja.jsonindex 3922532eb..6f40f897c 100644--- a/client/messages/ja.json+++ b/client/messages/ja.json@@ -805,9 +805,9 @@"lXZjmr": "この組織に新しいメンバーを招待します。","B3uRNN": "特定のサイトへのアクセスを制限","cEIr3W": "このメンバーは選択したサイトにのみアクセスできます。",- "DNeuzb": "チーム",- "wMcv1G": "招待を承認した際にメンバーをチームに追加することもできます。",- "OtSSs+": "{count}サイト",+ "wsUmh9": "",+ "zUJjPA": "",+ "WdvGbR": "","ptwP96": "招待中...","hYOE+U": "招待","x8CB7X": "サイトアクセスが正常に更新されました",@@ -835,6 +835,7 @@"i7B/4+": "この組織とすべてのデータを完全に削除","O8Sc7E": "サイトアクセス","l8wanU": "参加日",+ "OtSSs+": "{count}サイト","iv7EVe": "すべてのサイト","qrWOxx": "メンバーが見つかりません","Q5kEny": "組織を読み込み中...",@@ -864,6 +865,7 @@"iSNlf0": "チームの削除に失敗しました","oSW2J5": "チームを削除","+WnNru": "チーム\"{name}\"を削除してよろしいですか?このチームに割り当てられたサイトは未割り当てになり、すべてのメンバーに表示されます。",+ "DNeuzb": "チーム","f7uwif": "サイトをチームに整理して、どのメンバーがアクセスできるかを制御します。","cPbI/I": "チーム設定を表示する権限がありません。","xA1LY9": "チームを管理するには、まず組織を作成するか組織に追加される必要があります。",diff --git a/client/messages/ko.json b/client/messages/ko.jsonindex 42770e904..68f89df12 100644--- a/client/messages/ko.json+++ b/client/messages/ko.json@@ -805,9 +805,9 @@"lXZjmr": "이 조직에 새 멤버를 초대합니다.","B3uRNN": "특정 사이트에 대한 액세스 제한","cEIr3W": "이 멤버는 선택한 사이트에만 액세스할 수 있습니다.",- "DNeuzb": "팀",- "wMcv1G": "초대를 수락할 때 이 멤버를 팀에 추가할 수 있습니다(선택사항).",- "OtSSs+": "{count}개 사이트",+ "wsUmh9": "",+ "zUJjPA": "",+ "WdvGbR": "","ptwP96": "초대 중...","hYOE+U": "초대","x8CB7X": "사이트 액세스가 성공적으로 업데이트되었습니다",@@ -835,6 +835,7 @@"i7B/4+": "이 조직과 모든 데이터를 영구적으로 삭제합니다","O8Sc7E": "사이트 접근","l8wanU": "가입일",+ "OtSSs+": "{count}개 사이트","iv7EVe": "모든 사이트","qrWOxx": "멤버를 찾을 수 없음","Q5kEny": "조직 로딩 중...",@@ -864,6 +865,7 @@"iSNlf0": "팀 삭제에 실패했습니다","oSW2J5": "팀 삭제","+WnNru": "팀 \"{name}\"을(를) 삭제하시겠습니까? 이 팀에 할당된 사이트는 할당 해제되어 모든 멤버에게 표시됩니다.",+ "DNeuzb": "팀","f7uwif": "어떤 멤버가 사이트에 액세스할 수 있는지 제어하기 위해 팀에 사이트를 구성합니다.","cPbI/I": "팀 설정을 볼 권한이 없습니다.","xA1LY9": "팀을 관리하려면 먼저 조직을 만들거나 추가되어야 합니다.",diff --git a/client/messages/pl.json b/client/messages/pl.jsonindex b5a6fea2e..ce2749918 100644--- a/client/messages/pl.json+++ b/client/messages/pl.json@@ -805,9 +805,9 @@"lXZjmr": "Zaproś nowego członka do tej organizacji.","B3uRNN": "Ogranicz dostęp do określonych witryn","cEIr3W": "Ten członek będzie miał dostęp tylko do wybranych witryn.",- "DNeuzb": "Zespoły",- "wMcv1G": "Opcjonalnie dodaj tego członka do zespołów po zaakceptowaniu zaproszenia.",- "OtSSs+": "{count} stron",+ "wsUmh9": "",+ "zUJjPA": "",+ "WdvGbR": "","ptwP96": "Zapraszanie...","hYOE+U": "Zaproś","x8CB7X": "Dostęp do witryny został pomyślnie zaktualizowany",@@ -835,6 +835,7 @@"i7B/4+": "Trwale usuń tę organizację i wszystkie jej dane","O8Sc7E": "Dostęp do stron","l8wanU": "Dołączył",+ "OtSSs+": "{count} stron","iv7EVe": "Wszystkie strony","qrWOxx": "Nie znaleziono członków","Q5kEny": "Ładowanie organizacji...",@@ -864,6 +865,7 @@"iSNlf0": "Nie udało się usunąć zespołu","oSW2J5": "Usuń zespół","+WnNru": "Czy na pewno chcesz usunąć zespół \"{name}\"? Witryny przypisane do tego zespołu staną się nieprzypisane i widoczne dla wszystkich członków.",+ "DNeuzb": "Zespoły","f7uwif": "Organizuj witryny w zespoły, aby kontrolować, którzy członkowie mogą do nich uzyskać dostęp.","cPbI/I": "Nie masz uprawnień do wyświetlania ustawień zespołu.","xA1LY9": "Musisz utworzyć lub zostać dodany do organizacji, zanim będziesz mógł zarządzać zespołami.",diff --git a/client/messages/pt.json b/client/messages/pt.jsonindex 965d2726c..956f880f5 100644--- a/client/messages/pt.json+++ b/client/messages/pt.json@@ -805,9 +805,9 @@"lXZjmr": "Convide um novo membro para esta organização.","B3uRNN": "Restringir acesso a sites específicos","cEIr3W": "Este membro só terá acesso aos sites selecionados.",- "DNeuzb": "Times",- "wMcv1G": "Opcionalmente, adicione este membro a times quando aceitar o convite.",- "OtSSs+": "{count} sites",+ "wsUmh9": "",+ "zUJjPA": "",+ "WdvGbR": "","ptwP96": "Convidando...","hYOE+U": "Convidar","x8CB7X": "Acesso ao site atualizado com sucesso",@@ -835,6 +835,7 @@"i7B/4+": "Excluir permanentemente esta organização e todos os seus dados","O8Sc7E": "Acesso ao Site","l8wanU": "Entrou",+ "OtSSs+": "{count} sites","iv7EVe": "Todos os sites","qrWOxx": "Nenhum membro encontrado","Q5kEny": "Carregando organização...",@@ -864,6 +865,7 @@"iSNlf0": "Falha ao excluir time","oSW2J5": "Excluir time","+WnNru": "Tem certeza que deseja excluir o time \"{name}\"? Os sites atribuídos a este time ficarão sem atribuição e visíveis para todos os membros.",+ "DNeuzb": "Times","f7uwif": "Organize sites em times para controlar quais membros podem acessá-los.","cPbI/I": "Você não tem permissão para ver as configurações do time.","xA1LY9": "Você precisa criar ou ser adicionado a uma organização antes de gerenciar times.",diff --git a/client/messages/zh.json b/client/messages/zh.jsonindex 3fd349f68..431d00200 100644--- a/client/messages/zh.json+++ b/client/messages/zh.json@@ -805,9 +805,9 @@"lXZjmr": "邀请此组织的新成员。","B3uRNN": "限制对特定站点的访问","cEIr3W": "此成员只能访问所选站点。",- "DNeuzb": "团队",- "wMcv1G": "可选择在成员接受邀请时将其添加到团队。",- "OtSSs+": "{count} 个网站",+ "wsUmh9": "",+ "zUJjPA": "",+ "WdvGbR": "","ptwP96": "正在邀请...","hYOE+U": "邀请","x8CB7X": "站点访问权限更新成功",@@ -835,6 +835,7 @@"i7B/4+": "永久删除此组织及其所有数据","O8Sc7E": "网站访问权限","l8wanU": "已加入",+ "OtSSs+": "{count} 个网站","iv7EVe": "所有网站","qrWOxx": "未找到成员","Q5kEny": "正在加载组织...",@@ -864,6 +865,7 @@"iSNlf0": "删除团队失败","oSW2J5": "删除团队","+WnNru": "确定要删除团队\"{name}\"吗?分配给此团队的站点将变为未分配状态,所有成员均可见。",+ "DNeuzb": "团队","f7uwif": "将站点组织成团队以控制哪些成员可以访问它们。","cPbI/I": "您没有权限查看团队设置。","xA1LY9": "您需要先创建或加入一个组织,才能管理团队。",diff --git a/client/src/app/settings/organization/components/InviteMemberDialog.tsx b/client/src/app/settings/organization/components/InviteMemberDialog.tsxindex c3388faf2..1bc5cb70e 100644--- a/client/src/app/settings/organization/components/InviteMemberDialog.tsx+++ b/client/src/app/settings/organization/components/InviteMemberDialog.tsx@@ -55,7 +55,7 @@ export function InviteMemberDialog({ organizationId, onSuccess, memberCount }: Iconst [role, setRole] = useState<"admin" | "member" | "owner">("member");const [restrictSiteAccess, setRestrictSiteAccess] = useState(false);const [selectedSiteIds, setSelectedSiteIds] = useState<number[]>([]);- const [selectedTeamIds, setSelectedTeamIds] = useState<string[]>([]);+ const [selectedTeamId, setSelectedTeamId] = useState<string>("none");const [open, setOpen] = useState(false);const [error, setError] = useState("");@@ -67,19 +67,18 @@ export function InviteMemberDialog({ organizationId, onSuccess, memberCount }: Irole,organizationId,resend: true,+ ...(selectedTeamId && selectedTeamId !== "none" ? { teamId: selectedTeamId } : {}),});- // Update invitation with site access restrictions and/or team assignments- const hasTeamAssignments = selectedTeamIds.length > 0;+ // Update invitation with site access restrictionsconst hasSiteRestrictions = role === "member" && restrictSiteAccess;- if ((hasSiteRestrictions || hasTeamAssignments) && result.data?.id) {+ if (hasSiteRestrictions && result.data?.id) {await authedFetch(`/organizations/${organizationId}/invitations/${result.data.id}/sites`, undefined, {method: "PUT",data: {- hasRestrictedSiteAccess: hasSiteRestrictions,- siteIds: hasSiteRestrictions ? selectedSiteIds : [],- teamIds: selectedTeamIds,+ hasRestrictedSiteAccess: true,+ siteIds: selectedSiteIds,},});}@@ -95,7 +94,7 @@ export function InviteMemberDialog({ organizationId, onSuccess, memberCount }: IsetRole("member");setRestrictSiteAccess(false);setSelectedSiteIds([]);- setSelectedTeamIds([]);+ setSelectedTeamId("none");setError("");},onError: (err: any) => {@@ -214,33 +213,23 @@ export function InviteMemberDialog({ organizationId, onSuccess, memberCount }: I{teams.length > 0 && (<div className="grid gap-2">- <Label>{t("Teams")}</Label>+ <Label>{t("Team")}</Label>+ <Select value={selectedTeamId} onValueChange={setSelectedTeamId}>+ <SelectTrigger>+ <SelectValue placeholder={t("No team")} />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="none">{t("No team")}</SelectItem>+ {teams.map(team => (+ <SelectItem key={team.id} value={team.id}>+ {team.name}+ </SelectItem>+ ))}+ </SelectContent>+ </Select><p className="text-xs text-muted-foreground">- {t("Optionally add this member to teams when they accept the invitation.")}+ {t("Optionally add this member to a team when they accept the invitation.")}</p>- <div className="border rounded-lg divide-y max-h-40 overflow-y-auto">- {teams.map(team => (- <div key={team.id} className="flex items-center space-x-3 p-2.5 hover:bg-muted/50">- <Checkbox- id={`team-${team.id}`}- checked={selectedTeamIds.includes(team.id)}- onCheckedChange={() => {- setSelectedTeamIds(prev =>- prev.includes(team.id)- ? prev.filter(id => id !== team.id)- : [...prev, team.id]- );- }}- />- <Label htmlFor={`team-${team.id}`} className="flex-1 cursor-pointer text-sm">- <span className="font-medium">{team.name}</span>- <span className="text-muted-foreground ml-2">- {t("{count} sites", { count: String(team.sites.length) })}- </span>- </Label>- </div>- ))}- </div></div>)}diff --git a/server/drizzle/0003_careful_maelstrom.sql b/server/drizzle/0003_careful_maelstrom.sqlnew file mode 100644index 000000000..50c0f06bd--- /dev/null+++ b/server/drizzle/0003_careful_maelstrom.sql@@ -0,0 +1,3 @@+ALTER TABLE "invitation" ADD COLUMN "teamId" text;--> statement-breakpoint+ALTER TABLE "invitation" ADD CONSTRAINT "invitation_teamId_team_id_fk" FOREIGN KEY ("teamId") REFERENCES "public"."team"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint+ALTER TABLE "invitation" DROP COLUMN "team_ids";\ No newline at end of filediff --git a/server/drizzle/meta/0002_snapshot.json b/server/drizzle/meta/0002_snapshot.jsonindex aed0eb033..bf20e8b20 100644--- a/server/drizzle/meta/0002_snapshot.json+++ b/server/drizzle/meta/0002_snapshot.json@@ -1615,20 +1615,20 @@"primaryKey": false,"notNull": true},- "organization_id": {- "name": "organization_id",+ "organizationId": {+ "name": "organizationId","type": "text","primaryKey": false,"notNull": true},- "created_at": {- "name": "created_at",+ "createdAt": {+ "name": "createdAt","type": "timestamp","primaryKey": false,"notNull": true},- "updated_at": {- "name": "updated_at",+ "updatedAt": {+ "name": "updatedAt","type": "timestamp","primaryKey": false,"notNull": false@@ -1636,12 +1636,12 @@},"indexes": {},"foreignKeys": {- "team_organization_id_organization_id_fk": {- "name": "team_organization_id_organization_id_fk",+ "team_organizationId_organization_id_fk": {+ "name": "team_organizationId_organization_id_fk","tableFrom": "team","tableTo": "organization","columnsFrom": [- "organization_id"+ "organizationId"],"columnsTo": ["id"@@ -1666,20 +1666,20 @@"primaryKey": true,"notNull": true},- "team_id": {- "name": "team_id",+ "teamId": {+ "name": "teamId","type": "text","primaryKey": false,"notNull": true},- "user_id": {- "name": "user_id",+ "userId": {+ "name": "userId","type": "text","primaryKey": false,"notNull": true},- "created_at": {- "name": "created_at",+ "createdAt": {+ "name": "createdAt","type": "timestamp","primaryKey": false,"notNull": false@@ -1687,12 +1687,12 @@},"indexes": {},"foreignKeys": {- "teamMember_team_id_team_id_fk": {- "name": "teamMember_team_id_team_id_fk",+ "teamMember_teamId_team_id_fk": {+ "name": "teamMember_teamId_team_id_fk","tableFrom": "teamMember","tableTo": "team","columnsFrom": [- "team_id"+ "teamId"],"columnsTo": ["id"@@ -1700,12 +1700,12 @@"onDelete": "cascade","onUpdate": "no action"},- "teamMember_user_id_user_id_fk": {- "name": "teamMember_user_id_user_id_fk",+ "teamMember_userId_user_id_fk": {+ "name": "teamMember_userId_user_id_fk","tableFrom": "teamMember","tableTo": "user","columnsFrom": [- "user_id"+ "userId"],"columnsTo": ["id"diff --git a/server/drizzle/meta/0003_snapshot.json b/server/drizzle/meta/0003_snapshot.jsonnew file mode 100644index 000000000..48242dee4--- /dev/null+++ b/server/drizzle/meta/0003_snapshot.json@@ -0,0 +1,2869 @@+{+ "id": "01633710-e3a8-4cf3-96d7-5c4c9150edbd",+ "prevId": "372ba8dc-511d-480e-b745-28cdc242cea8",+ "version": "7",+ "dialect": "postgresql",+ "tables": {+ "public.account": {+ "name": "account",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "accountId": {+ "name": "accountId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "providerId": {+ "name": "providerId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "accessToken": {+ "name": "accessToken",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "refreshToken": {+ "name": "refreshToken",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "idToken": {+ "name": "idToken",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "accessTokenExpiresAt": {+ "name": "accessTokenExpiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "refreshTokenExpiresAt": {+ "name": "refreshTokenExpiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "password": {+ "name": "password",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {+ "account_userId_user_id_fk": {+ "name": "account_userId_user_id_fk",+ "tableFrom": "account",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.active_sessions": {+ "name": "active_sessions",+ "schema": "",+ "columns": {+ "session_id": {+ "name": "session_id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "start_time": {+ "name": "start_time",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "last_activity": {+ "name": "last_activity",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.agent_regions": {+ "name": "agent_regions",+ "schema": "",+ "columns": {+ "code": {+ "name": "code",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "endpoint_url": {+ "name": "endpoint_url",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "last_health_check": {+ "name": "last_health_check",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "is_healthy": {+ "name": "is_healthy",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.apikey": {+ "name": "apikey",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "start": {+ "name": "start",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "prefix": {+ "name": "prefix",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "key": {+ "name": "key",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "referenceId": {+ "name": "referenceId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "refillInterval": {+ "name": "refillInterval",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "refillAmount": {+ "name": "refillAmount",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "lastRefillAt": {+ "name": "lastRefillAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "rateLimitEnabled": {+ "name": "rateLimitEnabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "rateLimitTimeWindow": {+ "name": "rateLimitTimeWindow",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "rateLimitMax": {+ "name": "rateLimitMax",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "requestCount": {+ "name": "requestCount",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "remaining": {+ "name": "remaining",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "lastRequest": {+ "name": "lastRequest",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "expiresAt": {+ "name": "expiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "configId": {+ "name": "configId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "permissions": {+ "name": "permissions",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "metadata": {+ "name": "metadata",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "apikey_referenceId_user_id_fk": {+ "name": "apikey_referenceId_user_id_fk",+ "tableFrom": "apikey",+ "tableTo": "user",+ "columnsFrom": [+ "referenceId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.cancellation_feedback": {+ "name": "cancellation_feedback",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "reason": {+ "name": "reason",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "reason_details": {+ "name": "reason_details",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "retention_offer_shown": {+ "name": "retention_offer_shown",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "retention_offer_accepted": {+ "name": "retention_offer_accepted",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "outcome": {+ "name": "outcome",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "plan_name_at_cancellation": {+ "name": "plan_name_at_cancellation",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "monthly_event_count_at_cancellation": {+ "name": "monthly_event_count_at_cancellation",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.funnels": {+ "name": "funnels",+ "schema": "",+ "columns": {+ "report_id": {+ "name": "report_id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "data": {+ "name": "data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "funnels_site_id_sites_site_id_fk": {+ "name": "funnels_site_id_sites_site_id_fk",+ "tableFrom": "funnels",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "funnels_user_id_user_id_fk": {+ "name": "funnels_user_id_user_id_fk",+ "tableFrom": "funnels",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.goals": {+ "name": "goals",+ "schema": "",+ "columns": {+ "goal_id": {+ "name": "goal_id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "goal_type": {+ "name": "goal_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "goals_site_id_sites_site_id_fk": {+ "name": "goals_site_id_sites_site_id_fk",+ "tableFrom": "goals",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.gsc_connections": {+ "name": "gsc_connections",+ "schema": "",+ "columns": {+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true+ },+ "access_token": {+ "name": "access_token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "refresh_token": {+ "name": "refresh_token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "expires_at": {+ "name": "expires_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "gsc_property_url": {+ "name": "gsc_property_url",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "gsc_connections_site_id_sites_site_id_fk": {+ "name": "gsc_connections_site_id_sites_site_id_fk",+ "tableFrom": "gsc_connections",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.import_status": {+ "name": "import_status",+ "schema": "",+ "columns": {+ "import_id": {+ "name": "import_id",+ "type": "uuid",+ "primaryKey": true,+ "notNull": true,+ "default": "gen_random_uuid()"+ },+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "platform": {+ "name": "platform",+ "type": "import_platform_enum",+ "typeSchema": "public",+ "primaryKey": false,+ "notNull": true+ },+ "imported_events": {+ "name": "imported_events",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "skipped_events": {+ "name": "skipped_events",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "invalid_events": {+ "name": "invalid_events",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "default": 0+ },+ "started_at": {+ "name": "started_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "completed_at": {+ "name": "completed_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "import_status_site_id_sites_site_id_fk": {+ "name": "import_status_site_id_sites_site_id_fk",+ "tableFrom": "import_status",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "import_status_organization_id_organization_id_fk": {+ "name": "import_status_organization_id_organization_id_fk",+ "tableFrom": "import_status",+ "tableTo": "organization",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.invitation": {+ "name": "invitation",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "inviterId": {+ "name": "inviterId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "organizationId": {+ "name": "organizationId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "expiresAt": {+ "name": "expiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "has_restricted_site_access": {+ "name": "has_restricted_site_access",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ },+ "site_ids": {+ "name": "site_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[]'::jsonb"+ },+ "teamId": {+ "name": "teamId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "invitation_inviterId_user_id_fk": {+ "name": "invitation_inviterId_user_id_fk",+ "tableFrom": "invitation",+ "tableTo": "user",+ "columnsFrom": [+ "inviterId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "invitation_organizationId_organization_id_fk": {+ "name": "invitation_organizationId_organization_id_fk",+ "tableFrom": "invitation",+ "tableTo": "organization",+ "columnsFrom": [+ "organizationId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "invitation_teamId_team_id_fk": {+ "name": "invitation_teamId_team_id_fk",+ "tableFrom": "invitation",+ "tableTo": "team",+ "columnsFrom": [+ "teamId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.member": {+ "name": "member",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "organizationId": {+ "name": "organizationId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "has_restricted_site_access": {+ "name": "has_restricted_site_access",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "member_organizationId_organization_id_fk": {+ "name": "member_organizationId_organization_id_fk",+ "tableFrom": "member",+ "tableTo": "organization",+ "columnsFrom": [+ "organizationId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "member_userId_user_id_fk": {+ "name": "member_userId_user_id_fk",+ "tableFrom": "member",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.member_site_access": {+ "name": "member_site_access",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "member_id": {+ "name": "member_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "created_by": {+ "name": "created_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {+ "member_site_access_member_idx": {+ "name": "member_site_access_member_idx",+ "columns": [+ {+ "expression": "member_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "member_site_access_site_idx": {+ "name": "member_site_access_site_idx",+ "columns": [+ {+ "expression": "site_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "member_site_access_member_id_member_id_fk": {+ "name": "member_site_access_member_id_member_id_fk",+ "tableFrom": "member_site_access",+ "tableTo": "member",+ "columnsFrom": [+ "member_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "member_site_access_site_id_sites_site_id_fk": {+ "name": "member_site_access_site_id_sites_site_id_fk",+ "tableFrom": "member_site_access",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "member_site_access_created_by_user_id_fk": {+ "name": "member_site_access_created_by_user_id_fk",+ "tableFrom": "member_site_access",+ "tableTo": "user",+ "columnsFrom": [+ "created_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "member_site_access_unique": {+ "name": "member_site_access_unique",+ "nullsNotDistinct": false,+ "columns": [+ "member_id",+ "site_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.notification_channels": {+ "name": "notification_channels",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "config": {+ "name": "config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "monitor_ids": {+ "name": "monitor_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "trigger_events": {+ "name": "trigger_events",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[\"down\",\"recovery\"]'::jsonb"+ },+ "cooldown_minutes": {+ "name": "cooldown_minutes",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 5+ },+ "last_notified_at": {+ "name": "last_notified_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "created_by": {+ "name": "created_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "notification_channels_organization_id_organization_id_fk": {+ "name": "notification_channels_organization_id_organization_id_fk",+ "tableFrom": "notification_channels",+ "tableTo": "organization",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "notification_channels_created_by_user_id_fk": {+ "name": "notification_channels_created_by_user_id_fk",+ "tableFrom": "notification_channels",+ "tableTo": "user",+ "columnsFrom": [+ "created_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.organization": {+ "name": "organization",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "slug": {+ "name": "slug",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "logo": {+ "name": "logo",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "metadata": {+ "name": "metadata",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "stripeCustomerId": {+ "name": "stripeCustomerId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "monthlyEventCount": {+ "name": "monthlyEventCount",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "overMonthlyLimit": {+ "name": "overMonthlyLimit",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "planOverride": {+ "name": "planOverride",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "custom_plan": {+ "name": "custom_plan",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "organization_slug_unique": {+ "name": "organization_slug_unique",+ "nullsNotDistinct": false,+ "columns": [+ "slug"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.session": {+ "name": "session",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "expiresAt": {+ "name": "expiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "ipAddress": {+ "name": "ipAddress",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "userAgent": {+ "name": "userAgent",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "impersonatedBy": {+ "name": "impersonatedBy",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "activeOrganizationId": {+ "name": "activeOrganizationId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "session_userId_user_id_fk": {+ "name": "session_userId_user_id_fk",+ "tableFrom": "session",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "session_token_unique": {+ "name": "session_token_unique",+ "nullsNotDistinct": false,+ "columns": [+ "token"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.sites": {+ "name": "sites",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "site_id": {+ "name": "site_id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "domain": {+ "name": "domain",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "created_by": {+ "name": "created_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "public": {+ "name": "public",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "saltUserIds": {+ "name": "saltUserIds",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "blockBots": {+ "name": "blockBots",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true,+ "default": true+ },+ "excluded_ips": {+ "name": "excluded_ips",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[]'::jsonb"+ },+ "excluded_countries": {+ "name": "excluded_countries",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[]'::jsonb"+ },+ "sessionReplay": {+ "name": "sessionReplay",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "webVitals": {+ "name": "webVitals",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "trackErrors": {+ "name": "trackErrors",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "trackOutbound": {+ "name": "trackOutbound",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "trackUrlParams": {+ "name": "trackUrlParams",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "trackInitialPageView": {+ "name": "trackInitialPageView",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "trackSpaNavigation": {+ "name": "trackSpaNavigation",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "trackIp": {+ "name": "trackIp",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "trackButtonClicks": {+ "name": "trackButtonClicks",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "trackCopy": {+ "name": "trackCopy",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "trackFormInteractions": {+ "name": "trackFormInteractions",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "api_key": {+ "name": "api_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "private_link_key": {+ "name": "private_link_key",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "tags": {+ "name": "tags",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[]'::jsonb"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "sites_created_by_user_id_fk": {+ "name": "sites_created_by_user_id_fk",+ "tableFrom": "sites",+ "tableTo": "user",+ "columnsFrom": [+ "created_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "sites_organization_id_organization_id_fk": {+ "name": "sites_organization_id_organization_id_fk",+ "tableFrom": "sites",+ "tableTo": "organization",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.team": {+ "name": "team",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "organizationId": {+ "name": "organizationId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "team_organizationId_organization_id_fk": {+ "name": "team_organizationId_organization_id_fk",+ "tableFrom": "team",+ "tableTo": "organization",+ "columnsFrom": [+ "organizationId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.teamMember": {+ "name": "teamMember",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "teamId": {+ "name": "teamId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "userId": {+ "name": "userId",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "teamMember_teamId_team_id_fk": {+ "name": "teamMember_teamId_team_id_fk",+ "tableFrom": "teamMember",+ "tableTo": "team",+ "columnsFrom": [+ "teamId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "teamMember_userId_user_id_fk": {+ "name": "teamMember_userId_user_id_fk",+ "tableFrom": "teamMember",+ "tableTo": "user",+ "columnsFrom": [+ "userId"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.team_site_access": {+ "name": "team_site_access",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "team_id": {+ "name": "team_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "team_site_access_team_idx": {+ "name": "team_site_access_team_idx",+ "columns": [+ {+ "expression": "team_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "team_site_access_site_idx": {+ "name": "team_site_access_site_idx",+ "columns": [+ {+ "expression": "site_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "team_site_access_team_id_team_id_fk": {+ "name": "team_site_access_team_id_team_id_fk",+ "tableFrom": "team_site_access",+ "tableTo": "team",+ "columnsFrom": [+ "team_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "team_site_access_site_id_sites_site_id_fk": {+ "name": "team_site_access_site_id_sites_site_id_fk",+ "tableFrom": "team_site_access",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "team_site_access_unique": {+ "name": "team_site_access_unique",+ "nullsNotDistinct": false,+ "columns": [+ "team_id",+ "site_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.telemetry": {+ "name": "telemetry",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "instance_id": {+ "name": "instance_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "timestamp": {+ "name": "timestamp",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "version": {+ "name": "version",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "table_counts": {+ "name": "table_counts",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "clickhouse_size_gb": {+ "name": "clickhouse_size_gb",+ "type": "real",+ "primaryKey": false,+ "notNull": true+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.uptime_alert_history": {+ "name": "uptime_alert_history",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "alert_id": {+ "name": "alert_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "triggered_at": {+ "name": "triggered_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "alert_data": {+ "name": "alert_data",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "uptime_alert_history_alert_id_uptime_alerts_id_fk": {+ "name": "uptime_alert_history_alert_id_uptime_alerts_id_fk",+ "tableFrom": "uptime_alert_history",+ "tableTo": "uptime_alerts",+ "columnsFrom": [+ "alert_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "uptime_alert_history_monitor_id_uptime_monitors_id_fk": {+ "name": "uptime_alert_history_monitor_id_uptime_monitors_id_fk",+ "tableFrom": "uptime_alert_history",+ "tableTo": "uptime_monitors",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.uptime_alerts": {+ "name": "uptime_alerts",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "alert_type": {+ "name": "alert_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "alert_config": {+ "name": "alert_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "conditions": {+ "name": "conditions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "uptime_alerts_monitor_id_uptime_monitors_id_fk": {+ "name": "uptime_alerts_monitor_id_uptime_monitors_id_fk",+ "tableFrom": "uptime_alerts",+ "tableTo": "uptime_monitors",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.uptime_incidents": {+ "name": "uptime_incidents",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "region": {+ "name": "region",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "start_time": {+ "name": "start_time",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "end_time": {+ "name": "end_time",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'active'"+ },+ "acknowledged_by": {+ "name": "acknowledged_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "acknowledged_at": {+ "name": "acknowledged_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_by": {+ "name": "resolved_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "last_error": {+ "name": "last_error",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "last_error_type": {+ "name": "last_error_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "failure_count": {+ "name": "failure_count",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 1+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "uptime_incidents_organization_id_organization_id_fk": {+ "name": "uptime_incidents_organization_id_organization_id_fk",+ "tableFrom": "uptime_incidents",+ "tableTo": "organization",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "uptime_incidents_monitor_id_uptime_monitors_id_fk": {+ "name": "uptime_incidents_monitor_id_uptime_monitors_id_fk",+ "tableFrom": "uptime_incidents",+ "tableTo": "uptime_monitors",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "uptime_incidents_acknowledged_by_user_id_fk": {+ "name": "uptime_incidents_acknowledged_by_user_id_fk",+ "tableFrom": "uptime_incidents",+ "tableTo": "user",+ "columnsFrom": [+ "acknowledged_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ },+ "uptime_incidents_resolved_by_user_id_fk": {+ "name": "uptime_incidents_resolved_by_user_id_fk",+ "tableFrom": "uptime_incidents",+ "tableTo": "user",+ "columnsFrom": [+ "resolved_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.uptime_monitor_status": {+ "name": "uptime_monitor_status",+ "schema": "",+ "columns": {+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true+ },+ "last_checked_at": {+ "name": "last_checked_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "next_check_at": {+ "name": "next_check_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "current_status": {+ "name": "current_status",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "default": "'unknown'"+ },+ "consecutive_failures": {+ "name": "consecutive_failures",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "consecutive_successes": {+ "name": "consecutive_successes",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "uptime_percentage_24h": {+ "name": "uptime_percentage_24h",+ "type": "real",+ "primaryKey": false,+ "notNull": false+ },+ "uptime_percentage_7d": {+ "name": "uptime_percentage_7d",+ "type": "real",+ "primaryKey": false,+ "notNull": false+ },+ "uptime_percentage_30d": {+ "name": "uptime_percentage_30d",+ "type": "real",+ "primaryKey": false,+ "notNull": false+ },+ "average_response_time_24h": {+ "name": "average_response_time_24h",+ "type": "real",+ "primaryKey": false,+ "notNull": false+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ }+ },+ "indexes": {+ "uptime_monitor_status_updated_at_idx": {+ "name": "uptime_monitor_status_updated_at_idx",+ "columns": [+ {+ "expression": "updated_at",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "uptime_monitor_status_monitor_id_uptime_monitors_id_fk": {+ "name": "uptime_monitor_status_monitor_id_uptime_monitors_id_fk",+ "tableFrom": "uptime_monitor_status",+ "tableTo": "uptime_monitors",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {+ "uptime_monitor_status_current_status_check": {+ "name": "uptime_monitor_status_current_status_check",+ "value": "current_status IN ('up', 'down', 'unknown')"+ },+ "uptime_monitor_status_uptime_24h_check": {+ "name": "uptime_monitor_status_uptime_24h_check",+ "value": "uptime_percentage_24h >= 0 AND uptime_percentage_24h <= 100"+ },+ "uptime_monitor_status_uptime_7d_check": {+ "name": "uptime_monitor_status_uptime_7d_check",+ "value": "uptime_percentage_7d >= 0 AND uptime_percentage_7d <= 100"+ },+ "uptime_monitor_status_uptime_30d_check": {+ "name": "uptime_monitor_status_uptime_30d_check",+ "value": "uptime_percentage_30d >= 0 AND uptime_percentage_30d <= 100"+ }+ },+ "isRLSEnabled": false+ },+ "public.uptime_monitors": {+ "name": "uptime_monitors",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "organization_id": {+ "name": "organization_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "monitor_type": {+ "name": "monitor_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "interval_seconds": {+ "name": "interval_seconds",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "enabled": {+ "name": "enabled",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "http_config": {+ "name": "http_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "tcp_config": {+ "name": "tcp_config",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false+ },+ "validation_rules": {+ "name": "validation_rules",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": true,+ "default": "'[]'::jsonb"+ },+ "monitoring_type": {+ "name": "monitoring_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "default": "'local'"+ },+ "selected_regions": {+ "name": "selected_regions",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[\"local\"]'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false,+ "default": "now()"+ },+ "created_by": {+ "name": "created_by",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "uptime_monitors_organization_id_organization_id_fk": {+ "name": "uptime_monitors_organization_id_organization_id_fk",+ "tableFrom": "uptime_monitors",+ "tableTo": "organization",+ "columnsFrom": [+ "organization_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "uptime_monitors_created_by_user_id_fk": {+ "name": "uptime_monitors_created_by_user_id_fk",+ "tableFrom": "uptime_monitors",+ "tableTo": "user",+ "columnsFrom": [+ "created_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set null",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user": {+ "name": "user",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "username": {+ "name": "username",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "emailVerified": {+ "name": "emailVerified",+ "type": "boolean",+ "primaryKey": false,+ "notNull": true+ },+ "image": {+ "name": "image",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "default": "'user'"+ },+ "displayUsername": {+ "name": "displayUsername",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "banned": {+ "name": "banned",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false+ },+ "banReason": {+ "name": "banReason",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "banExpires": {+ "name": "banExpires",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "stripeCustomerId": {+ "name": "stripeCustomerId",+ "type": "text",+ "primaryKey": false,+ "notNull": false+ },+ "overMonthlyLimit": {+ "name": "overMonthlyLimit",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": false+ },+ "monthlyEventCount": {+ "name": "monthlyEventCount",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "default": 0+ },+ "sendAutoEmailReports": {+ "name": "sendAutoEmailReports",+ "type": "boolean",+ "primaryKey": false,+ "notNull": false,+ "default": true+ },+ "scheduled_tip_email_ids": {+ "name": "scheduled_tip_email_ids",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'[]'::jsonb"+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "user_username_unique": {+ "name": "user_username_unique",+ "nullsNotDistinct": false,+ "columns": [+ "username"+ ]+ },+ "user_email_unique": {+ "name": "user_email_unique",+ "nullsNotDistinct": false,+ "columns": [+ "email"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_aliases": {+ "name": "user_aliases",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "serial",+ "primaryKey": true,+ "notNull": true+ },+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "anonymous_id": {+ "name": "anonymous_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_aliases_user_idx": {+ "name": "user_aliases_user_idx",+ "columns": [+ {+ "expression": "site_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "user_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ },+ "user_aliases_anon_idx": {+ "name": "user_aliases_anon_idx",+ "columns": [+ {+ "expression": "site_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ },+ {+ "expression": "anonymous_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_aliases_site_id_sites_site_id_fk": {+ "name": "user_aliases_site_id_sites_site_id_fk",+ "tableFrom": "user_aliases",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {+ "user_aliases_site_anon_unique": {+ "name": "user_aliases_site_anon_unique",+ "nullsNotDistinct": false,+ "columns": [+ "site_id",+ "anonymous_id"+ ]+ }+ },+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.user_profiles": {+ "name": "user_profiles",+ "schema": "",+ "columns": {+ "site_id": {+ "name": "site_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true+ },+ "user_id": {+ "name": "user_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "traits": {+ "name": "traits",+ "type": "jsonb",+ "primaryKey": false,+ "notNull": false,+ "default": "'{}'::jsonb"+ },+ "created_at": {+ "name": "created_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true,+ "default": "now()"+ }+ },+ "indexes": {+ "user_profiles_site_idx": {+ "name": "user_profiles_site_idx",+ "columns": [+ {+ "expression": "site_id",+ "isExpression": false,+ "asc": true,+ "nulls": "last"+ }+ ],+ "isUnique": false,+ "concurrently": false,+ "method": "btree",+ "with": {}+ }+ },+ "foreignKeys": {+ "user_profiles_site_id_sites_site_id_fk": {+ "name": "user_profiles_site_id_sites_site_id_fk",+ "tableFrom": "user_profiles",+ "tableTo": "sites",+ "columnsFrom": [+ "site_id"+ ],+ "columnsTo": [+ "site_id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "user_profiles_site_id_user_id_pk": {+ "name": "user_profiles_site_id_user_id_pk",+ "columns": [+ "site_id",+ "user_id"+ ]+ }+ },+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ },+ "public.verification": {+ "name": "verification",+ "schema": "",+ "columns": {+ "id": {+ "name": "id",+ "type": "text",+ "primaryKey": true,+ "notNull": true+ },+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "value": {+ "name": "value",+ "type": "text",+ "primaryKey": false,+ "notNull": true+ },+ "expiresAt": {+ "name": "expiresAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": true+ },+ "createdAt": {+ "name": "createdAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ },+ "updatedAt": {+ "name": "updatedAt",+ "type": "timestamp",+ "primaryKey": false,+ "notNull": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "policies": {},+ "checkConstraints": {},+ "isRLSEnabled": false+ }+ },+ "enums": {+ "public.import_platform_enum": {+ "name": "import_platform_enum",+ "schema": "public",+ "values": [+ "umami",+ "simple_analytics"+ ]+ }+ },+ "schemas": {},+ "sequences": {},+ "roles": {},+ "policies": {},+ "views": {},+ "_meta": {+ "columns": {},+ "schemas": {},+ "tables": {}+ }+}\ No newline at end of filediff --git a/server/drizzle/meta/_journal.json b/server/drizzle/meta/_journal.jsonindex 32385ff9b..ffa7c96e0 100644--- a/server/drizzle/meta/_journal.json+++ b/server/drizzle/meta/_journal.json@@ -22,6 +22,13 @@"when": 1774244342221,"tag": "0002_short_bishop","breakpoints": true+ },+ {+ "idx": 3,+ "version": "7",+ "when": 1774762368551,+ "tag": "0003_careful_maelstrom",+ "breakpoints": true}]}\ No newline at end of filediff --git a/server/src/api/memberAccess/updateInvitationSiteAccess.ts b/server/src/api/memberAccess/updateInvitationSiteAccess.tsindex 40df5b218..88cffa6d7 100644--- a/server/src/api/memberAccess/updateInvitationSiteAccess.ts+++ b/server/src/api/memberAccess/updateInvitationSiteAccess.ts@@ -1,8 +1,8 @@-import { and, eq, inArray } from "drizzle-orm";+import { and, eq } from "drizzle-orm";import { FastifyReply, FastifyRequest } from "fastify";import { db } from "../../db/postgres/postgres.js";-import { invitation, sites, team } from "../../db/postgres/schema.js";+import { invitation, sites } from "../../db/postgres/schema.js";interface UpdateInvitationSiteAccessParams {organizationId: string;@@ -12,7 +12,6 @@ interface UpdateInvitationSiteAccessParams {interface UpdateInvitationSiteAccessBody {hasRestrictedSiteAccess: boolean;siteIds: number[];- teamIds?: string[];}export async function updateInvitationSiteAccess(@@ -23,7 +22,7 @@ export async function updateInvitationSiteAccess(reply: FastifyReply) {const { organizationId, invitationId } = request.params;- const { hasRestrictedSiteAccess, siteIds, teamIds } = request.body;+ const { hasRestrictedSiteAccess, siteIds } = request.body;try {// Verify the invitation exists and belongs to this organization@@ -54,30 +53,12 @@ export async function updateInvitationSiteAccess(}}- // Validate that all teamIds belong to this organization- if (teamIds && teamIds.length > 0) {- const validTeams = await db- .select({ id: team.id })- .from(team)- .where(and(eq(team.organizationId, organizationId), inArray(team.id, teamIds)));-- const validTeamIds = new Set(validTeams.map(t => t.id));- const invalidTeamIds = teamIds.filter(id => !validTeamIds.has(id));-- if (invalidTeamIds.length > 0) {- return reply.status(400).send({- error: `Invalid team IDs: ${invalidTeamIds.join(", ")}. Teams must belong to this organization.`,- });- }- }-- // Update the invitation with site access and team info+ // Update the invitation with site access infoawait db.update(invitation).set({hasRestrictedSiteAccess,siteIds: siteIds || [],- teamIds: teamIds || [],}).where(eq(invitation.id, invitationId));@@ -86,7 +67,6 @@ export async function updateInvitationSiteAccess(invitationId,hasRestrictedSiteAccess,siteIds,- teamIds,});} catch (error) {console.error("Error updating invitation site access:", error);diff --git a/server/src/db/postgres/schema.ts b/server/src/db/postgres/schema.tsindex bec321b1e..5acbd6f30 100644--- a/server/src/db/postgres/schema.ts+++ b/server/src/db/postgres/schema.ts@@ -178,7 +178,7 @@ export const invitation = pgTable("invitation", {// Site access restriction for the invited memberhasRestrictedSiteAccess: boolean("has_restricted_site_access").default(false).notNull(),siteIds: jsonb("site_ids").default([]).$type<number[]>(), // Array of site IDs to grant access to- teamIds: jsonb("team_ids").default([]).$type<string[]>(), // Array of team IDs to add the member to+ teamId: text().references(() => team.id, { onDelete: "set null" }),});// Member site access junction table - stores which sites a member has access todiff --git a/server/src/lib/auth.ts b/server/src/lib/auth.tsindex 19b39d788..90ae47db9 100644--- a/server/src/lib/auth.ts+++ b/server/src/lib/auth.ts@@ -9,7 +9,7 @@ import { apiKey } from "@better-auth/api-key"import { db } from "../db/postgres/postgres.js";import * as schema from "../db/postgres/schema.js";-import { invitation, member, memberSiteAccess, teamMember, user } from "../db/postgres/schema.js";+import { invitation, member, memberSiteAccess, user } from "../db/postgres/schema.js";import { DISABLE_SIGNUP, IS_CLOUD } from "./const.js";import { addContactToAudience, sendInvitationEmail, sendOtpEmail, sendWelcomeEmail } from "./email/email.js";import { onboardingTipsService } from "../services/onboardingTips/onboardingTipsService.js";@@ -220,21 +220,20 @@ export const auth = betterAuth({const invitationId = body?.invitationId;if (invitationId) {- // Query the invitation to get site access settings, team assignments, and org/email info+ // Query the invitation to get site access settings and org/email infoconst invitationRecord = await db.select({organizationId: invitation.organizationId,email: invitation.email,hasRestrictedSiteAccess: invitation.hasRestrictedSiteAccess,siteIds: invitation.siteIds,- teamIds: invitation.teamIds,}).from(invitation).where(eq(invitation.id, invitationId)).limit(1);if (invitationRecord.length > 0) {- const { organizationId, email, hasRestrictedSiteAccess, siteIds, teamIds } = invitationRecord[0];+ const { organizationId, email, hasRestrictedSiteAccess, siteIds } = invitationRecord[0];const userRecord = await db.select({ id: user.id }).from(user).where(eq(user.email, email)).limit(1);if (userRecord.length > 0) {@@ -265,19 +264,6 @@ export const auth = betterAuth({);}}-- // Copy team assignments- const teamIdArray = (teamIds || []) as string[];- if (teamIdArray.length > 0) {- await tx.insert(teamMember).values(- teamIdArray.map(teamId => ({- id: crypto.randomUUID(),- teamId,- userId,- createdAt: new Date().toISOString(),- }))- );- }}});}