mirror of
https://github.com/formbricks/formbricks.git
synced 2026-05-07 22:31:35 -05:00
chore: Rename Teams to Organizations (#2656)
Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { TActionClassNoCodeConfig } from "@formbricks/types/actionClasses";
|
||||
import { TIntegrationConfig } from "@formbricks/types/integration";
|
||||
import { TOrganizationBilling } from "@formbricks/types/organizations";
|
||||
import { TProductStyling } from "@formbricks/types/product";
|
||||
import { TResponseData, TResponseMeta, TResponsePersonAttributes } from "@formbricks/types/responses";
|
||||
import { TBaseFilters } from "@formbricks/types/segment";
|
||||
@@ -14,7 +15,6 @@ import {
|
||||
TSurveyVerifyEmail,
|
||||
TSurveyWelcomeCard,
|
||||
} from "@formbricks/types/surveys";
|
||||
import { TTeamBilling } from "@formbricks/types/teams";
|
||||
import { TUserNotificationSettings } from "@formbricks/types/user";
|
||||
|
||||
declare global {
|
||||
@@ -34,7 +34,7 @@ declare global {
|
||||
export type SurveyClosedMessage = TSurveyClosedMessage;
|
||||
export type SurveySingleUse = TSurveySingleUse;
|
||||
export type SurveyVerifyEmail = TSurveyVerifyEmail;
|
||||
export type TeamBilling = TTeamBilling;
|
||||
export type OrganizationBilling = TOrganizationBilling;
|
||||
export type UserNotificationSettings = TUserNotificationSettings;
|
||||
export type SegmentFilter = TBaseFilters;
|
||||
export type Styling = TProductStyling;
|
||||
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
-- Rename table from "Team" to "Organization"
|
||||
ALTER TABLE "Team" RENAME TO "Organization";
|
||||
ALTER TABLE "Organization" RENAME CONSTRAINT "Team_pkey" TO "Organization_pkey";
|
||||
|
||||
-- Rename column in the "Product" table
|
||||
ALTER TABLE "Product" RENAME COLUMN "teamId" TO "organizationId";
|
||||
|
||||
-- Rename column in the "Invite" table
|
||||
ALTER TABLE "Invite" RENAME COLUMN "teamId" TO "organizationId";
|
||||
|
||||
-- Rename column in the "Membership" table
|
||||
ALTER TABLE "Membership" RENAME COLUMN "teamId" TO "organizationId";
|
||||
|
||||
-- Rename foreign key constraints
|
||||
ALTER TABLE "Invite" RENAME CONSTRAINT "Invite_teamId_fkey" TO "Invite_organizationId_fkey";
|
||||
ALTER TABLE "Membership" RENAME CONSTRAINT "Membership_teamId_fkey" TO "Membership_organizationId_fkey";
|
||||
ALTER TABLE "Product" RENAME CONSTRAINT "Product_teamId_fkey" TO "Product_organizationId_fkey";
|
||||
|
||||
-- Rename indexes
|
||||
ALTER INDEX "Invite_email_teamId_idx" RENAME TO "Invite_email_organizationId_idx";
|
||||
ALTER INDEX "Invite_teamId_idx" RENAME TO "Invite_organizationId_idx";
|
||||
ALTER INDEX "Membership_teamId_idx" RENAME TO "Membership_organizationId_idx";
|
||||
ALTER INDEX "Product_teamId_idx" RENAME TO "Product_organizationId_idx";
|
||||
ALTER INDEX "Product_teamId_name_key" RENAME TO "Product_organizationId_name_key";
|
||||
|
||||
-- Drop and recreate primary key on Membership table
|
||||
ALTER TABLE "Membership" DROP CONSTRAINT "Membership_pkey";
|
||||
ALTER TABLE "Membership" ADD CONSTRAINT "Membership_pkey" PRIMARY KEY ("userId", "organizationId");
|
||||
@@ -422,8 +422,8 @@ model Product {
|
||||
createdAt DateTime @default(now()) @map(name: "created_at")
|
||||
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
||||
name String
|
||||
team Team @relation(fields: [teamId], references: [id], onDelete: Cascade)
|
||||
teamId String
|
||||
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
||||
organizationId String
|
||||
environments Environment[]
|
||||
brandColor String?
|
||||
highlightBorderColor String?
|
||||
@@ -441,19 +441,19 @@ model Product {
|
||||
/// [Logo]
|
||||
logo Json?
|
||||
|
||||
@@unique([teamId, name])
|
||||
@@index([teamId])
|
||||
@@unique([organizationId, name])
|
||||
@@index([organizationId])
|
||||
}
|
||||
|
||||
model Team {
|
||||
model Organization {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now()) @map(name: "created_at")
|
||||
updatedAt DateTime @updatedAt @map(name: "updated_at")
|
||||
name String
|
||||
memberships Membership[]
|
||||
products Product[]
|
||||
/// @zod.custom(imports.ZTeamBilling)
|
||||
/// [TeamBilling]
|
||||
/// @zod.custom(imports.ZOrganizationBilling)
|
||||
/// [OrganizationBilling]
|
||||
billing Json @default("{\"stripeCustomerId\": null, \"features\": {\"inAppSurvey\": {\"status\": \"inactive\", \"unlimited\": false}, \"linkSurvey\": {\"status\": \"inactive\", \"unlimited\": false}, \"userTargeting\": {\"status\": \"inactive\", \"unlimited\": false}}}")
|
||||
invites Invite[]
|
||||
}
|
||||
@@ -467,35 +467,35 @@ enum MembershipRole {
|
||||
}
|
||||
|
||||
model Membership {
|
||||
team Team @relation(fields: [teamId], references: [id], onDelete: Cascade)
|
||||
teamId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
userId String
|
||||
accepted Boolean @default(false)
|
||||
role MembershipRole
|
||||
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
||||
organizationId String
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
userId String
|
||||
accepted Boolean @default(false)
|
||||
role MembershipRole
|
||||
|
||||
@@id([userId, teamId])
|
||||
@@id([userId, organizationId])
|
||||
@@index([userId])
|
||||
@@index([teamId])
|
||||
@@index([organizationId])
|
||||
}
|
||||
|
||||
model Invite {
|
||||
id String @id @default(uuid())
|
||||
email String
|
||||
name String?
|
||||
team Team @relation(fields: [teamId], references: [id], onDelete: Cascade)
|
||||
teamId String
|
||||
creator User @relation("inviteCreatedBy", fields: [creatorId], references: [id])
|
||||
creatorId String
|
||||
acceptor User? @relation("inviteAcceptedBy", fields: [acceptorId], references: [id], onDelete: Cascade)
|
||||
acceptorId String?
|
||||
accepted Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
expiresAt DateTime
|
||||
role MembershipRole @default(admin)
|
||||
id String @id @default(uuid())
|
||||
email String
|
||||
name String?
|
||||
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
||||
organizationId String
|
||||
creator User @relation("inviteCreatedBy", fields: [creatorId], references: [id])
|
||||
creatorId String
|
||||
acceptor User? @relation("inviteAcceptedBy", fields: [acceptorId], references: [id], onDelete: Cascade)
|
||||
acceptorId String?
|
||||
accepted Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
expiresAt DateTime
|
||||
role MembershipRole @default(admin)
|
||||
|
||||
@@index([email, teamId])
|
||||
@@index([teamId])
|
||||
@@index([email, organizationId])
|
||||
@@index([organizationId])
|
||||
}
|
||||
|
||||
model ApiKey {
|
||||
|
||||
@@ -25,5 +25,5 @@ export {
|
||||
} from "@formbricks/types/surveys";
|
||||
|
||||
export { ZSegmentFilters } from "@formbricks/types/segment";
|
||||
export { ZTeamBilling } from "@formbricks/types/teams";
|
||||
export { ZOrganizationBilling } from "@formbricks/types/organizations";
|
||||
export { ZUserNotificationSettings } from "@formbricks/types/user";
|
||||
|
||||
Reference in New Issue
Block a user