@@ -1,2 +1,3 @@
|
||||
// Vercel
|
||||
// Vercel + RevenueCat
|
||||
export * from "./revenuecatModels/revenuecatMappingsTable.js";
|
||||
export * from "./vercelModels/vercelResourcesTable.js";
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { AppEnv } from "@models/genModels/genEnums";
|
||||
import { organizations } from "@models/orgModels/orgTable.js";
|
||||
import { foreignKey, pgTable, primaryKey, text } from "drizzle-orm/pg-core";
|
||||
|
||||
// biome-ignore lint/suspicious/noExplicitAny: Drizzle table typing workaround for Bun TS2742 error
|
||||
export const revenuecatMappings: any = pgTable(
|
||||
"revenuecat_mappings",
|
||||
{
|
||||
org_id: text("org_id").notNull(),
|
||||
env: text("env").$type<AppEnv>().notNull(),
|
||||
autumn_product_id: text("autumn_product_id").notNull(),
|
||||
revenuecat_product_ids: text("revenuecat_product_ids")
|
||||
.array()
|
||||
.notNull()
|
||||
.default([]),
|
||||
},
|
||||
(table) => [
|
||||
primaryKey({
|
||||
columns: [table.org_id, table.env, table.autumn_product_id],
|
||||
name: "revenuecat_mappings_pkey",
|
||||
}),
|
||||
foreignKey({
|
||||
columns: [table.org_id],
|
||||
foreignColumns: [organizations.id],
|
||||
name: "revenuecat_mappings_org_id_fkey",
|
||||
}).onDelete("cascade"),
|
||||
],
|
||||
);
|
||||
|
||||
export type RevenuecatMapping = typeof revenuecatMappings.$inferSelect;
|
||||
Reference in New Issue
Block a user