feat: billing portal
This commit is contained in:
2
packages/db/migrations/0002_bored_retro_girl.sql
Normal file
2
packages/db/migrations/0002_bored_retro_girl.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
CREATE TYPE "public"."workspace_plan" AS ENUM('free', 'pro', 'enterprise');--> statement-breakpoint
|
||||
ALTER TABLE "workspace" ADD COLUMN "plan" "workspace_plan" DEFAULT 'free' NOT NULL;
|
||||
1508
packages/db/migrations/meta/0002_snapshot.json
Normal file
1508
packages/db/migrations/meta/0002_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,13 @@
|
||||
"when": 1735821726274,
|
||||
"tag": "0001_little_red_hulk",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 2,
|
||||
"version": "7",
|
||||
"when": 1735904544867,
|
||||
"tag": "0002_bored_retro_girl",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -44,10 +44,11 @@ export const update = async (
|
||||
workspacePublicId: string,
|
||||
name: string | undefined,
|
||||
slug: string | undefined,
|
||||
plan?: "free" | "pro" | "enterprise",
|
||||
) => {
|
||||
const { data } = await db
|
||||
.from("workspace")
|
||||
.update({ name, slug })
|
||||
.update({ name, slug, plan })
|
||||
.eq("publicId", workspacePublicId)
|
||||
.is("deletedAt", null);
|
||||
|
||||
@@ -60,7 +61,7 @@ export const getByPublicId = async (
|
||||
) => {
|
||||
const { data } = await db
|
||||
.from("workspace")
|
||||
.select(`id, publicId, name`)
|
||||
.select(`id, publicId, name, plan`)
|
||||
.is("deletedAt", null)
|
||||
.eq("publicId", workspacePublicId)
|
||||
.limit(1)
|
||||
@@ -112,7 +113,8 @@ export const getAllByUserId = async (
|
||||
workspace (
|
||||
publicId,
|
||||
name,
|
||||
slug
|
||||
slug,
|
||||
plan
|
||||
)
|
||||
`,
|
||||
)
|
||||
|
||||
@@ -40,6 +40,11 @@ export const activityTypeEnum = pgEnum("card_activity_type", [
|
||||
"card.archived",
|
||||
]);
|
||||
export const slugTypeEnum = pgEnum("slug_type", ["reserved", "premium"]);
|
||||
export const workspacePlanEnum = pgEnum("workspace_plan", [
|
||||
"free",
|
||||
"pro",
|
||||
"enterprise",
|
||||
]);
|
||||
|
||||
export const boards = pgTable("board", {
|
||||
id: bigserial("id", { mode: "number" }).primaryKey(),
|
||||
@@ -289,6 +294,7 @@ export const workspaces = pgTable("workspace", {
|
||||
publicId: varchar("publicId", { length: 12 }).notNull().unique(),
|
||||
name: varchar("name", { length: 255 }).notNull(),
|
||||
slug: varchar("slug", { length: 255 }).notNull().unique(),
|
||||
plan: workspacePlanEnum("plan").notNull().default("free"),
|
||||
createdBy: uuid("createdBy")
|
||||
.notNull()
|
||||
.references(() => users.id),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user