feat: update workspace and subscripton schema
This commit is contained in:
2543
packages/db/migrations/meta/20250910195058_snapshot.json
Normal file
2543
packages/db/migrations/meta/20250910195058_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
2626
packages/db/migrations/meta/20250910200416_snapshot.json
Normal file
2626
packages/db/migrations/meta/20250910200416_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
2626
packages/db/migrations/meta/20250910202358_snapshot.json
Normal file
2626
packages/db/migrations/meta/20250910202358_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -78,6 +78,27 @@
|
|||||||
"when": 1757271312974,
|
"when": 1757271312974,
|
||||||
"tag": "20250907185512_AddUnlimitedSeatsToSubscription",
|
"tag": "20250907185512_AddUnlimitedSeatsToSubscription",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 11,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1757533858687,
|
||||||
|
"tag": "20250910195058_RemoveNotNullConstraintFromReferenceIdOnSubsriptions",
|
||||||
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 12,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1757534656098,
|
||||||
|
"tag": "20250910200416_AddWorkspaceSlugChecks",
|
||||||
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 13,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1757535838766,
|
||||||
|
"tag": "20250910202358_AddCascadeSetNullToReferenceIdOnSubsriptions",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -13,9 +13,10 @@ import { workspaces } from "./workspaces";
|
|||||||
export const subscription = pgTable("subscription", {
|
export const subscription = pgTable("subscription", {
|
||||||
id: bigserial("id", { mode: "number" }).primaryKey(),
|
id: bigserial("id", { mode: "number" }).primaryKey(),
|
||||||
plan: varchar("plan", { length: 255 }).notNull(),
|
plan: varchar("plan", { length: 255 }).notNull(),
|
||||||
referenceId: varchar("referenceId", { length: 12 })
|
referenceId: varchar("referenceId", { length: 12 }).references(
|
||||||
.notNull()
|
() => workspaces.publicId,
|
||||||
.references(() => workspaces.publicId),
|
{ onDelete: "set null" },
|
||||||
|
),
|
||||||
stripeCustomerId: varchar("stripeCustomerId", { length: 255 }),
|
stripeCustomerId: varchar("stripeCustomerId", { length: 255 }),
|
||||||
stripeSubscriptionId: varchar("stripeSubscriptionId", { length: 255 }),
|
stripeSubscriptionId: varchar("stripeSubscriptionId", { length: 255 }),
|
||||||
status: varchar("status", { length: 255 }).notNull(),
|
status: varchar("status", { length: 255 }).notNull(),
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { relations } from "drizzle-orm";
|
|||||||
import {
|
import {
|
||||||
bigint,
|
bigint,
|
||||||
bigserial,
|
bigserial,
|
||||||
|
boolean,
|
||||||
pgEnum,
|
pgEnum,
|
||||||
pgTable,
|
pgTable,
|
||||||
text,
|
text,
|
||||||
@@ -103,3 +104,17 @@ export const slugs = pgTable("workspace_slugs", {
|
|||||||
slug: varchar("slug", { length: 255 }).notNull().unique(),
|
slug: varchar("slug", { length: 255 }).notNull().unique(),
|
||||||
type: slugTypeEnum("type").notNull(),
|
type: slugTypeEnum("type").notNull(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const slugChecks = pgTable("workspace_slug_checks", {
|
||||||
|
id: bigserial("id", { mode: "number" }).primaryKey(),
|
||||||
|
slug: varchar("slug", { length: 255 }).notNull(),
|
||||||
|
available: boolean("available").notNull(),
|
||||||
|
reserved: boolean("reserved").notNull(),
|
||||||
|
workspaceId: bigint("workspaceId", { mode: "number" }).references(
|
||||||
|
() => workspaces.id,
|
||||||
|
),
|
||||||
|
createdBy: uuid("createdBy").references(() => users.id, {
|
||||||
|
onDelete: "set null",
|
||||||
|
}),
|
||||||
|
createdAt: timestamp("createdAt").defaultNow().notNull(),
|
||||||
|
}).enableRLS();
|
||||||
|
|||||||
Reference in New Issue
Block a user