Spaces:
Sleeping
Sleeping
Download src/libs/shared/infrastructure/postgres/schema/userWorkspaces.ts from fouadkhalid123/asd: direct link, hf CLI and curl.
- Browser
- Download file 1.27 kB
-
https://huggingface.co/spaces/fouadkhalid123/asd/resolve/main/src/libs/shared/infrastructure/postgres/schema/userWorkspaces.ts
- Command line
-
hf download hf://spaces/fouadkhalid123/asd/src/libs/shared/infrastructure/postgres/schema/userWorkspaces.ts
-
curl -L -o userWorkspaces.ts https://huggingface.co/spaces/fouadkhalid123/asd/resolve/main/src/libs/shared/infrastructure/postgres/schema/userWorkspaces.ts
1.27 kB
| import { pgTable, uuid, text, timestamp, uniqueIndex, index } from "drizzle-orm/pg-core"; | |
| import { users } from "./users"; | |
| import { organizations } from "./organizations"; | |
| import { stores } from "../../../../../modules/shopify/infrastructure/postgres/schema/stores"; | |
| export const userWorkspaces = pgTable("user_workspaces", { | |
| id: uuid("id").primaryKey().defaultRandom(), | |
| userId: uuid("user_id").notNull().references(() => users.id, { onDelete: "cascade" }), | |
| organizationId: uuid("organization_id").notNull().references(() => organizations.id, { onDelete: "cascade" }), | |
| storeId: uuid("store_id").references(() => stores.id, { onDelete: "set null" }), | |
| role: text("role").default("admin").notNull(), | |
| createdAt: timestamp("created_at").defaultNow().notNull(), | |
| updatedAt: timestamp("updated_at").defaultNow().notNull(), | |
| }, (table) => ({ | |
| userOrgStoreIdx: uniqueIndex("user_org_store_unique_idx").on(table.userId, table.organizationId, table.storeId), | |
| userIdx: index("user_workspaces_user_id_idx").on(table.userId), | |
| orgIdx: index("user_workspaces_organization_id_idx").on(table.organizationId), | |
| })); | |
| export type UserWorkspace = typeof userWorkspaces.$inferSelect; | |
| export type NewUserWorkspace = typeof userWorkspaces.$inferInsert; | |