@coursebuilder/adapter-drizzle
Version:
Drizzle adapter for Course Builder.
53 lines (51 loc) • 1.61 kB
JavaScript
import {
__name
} from "./chunk-H736K5TN.js";
// src/lib/mysql/schemas/content/contribution-types.ts
import { relations } from "drizzle-orm";
import { boolean, index, text, timestamp, varchar } from "drizzle-orm/mysql-core";
function getContributionTypesSchema(mysqlTable) {
return mysqlTable("ContributionType", {
id: varchar("id", {
length: 255
}).notNull().primaryKey(),
organizationId: varchar("organizationId", {
length: 191
}),
slug: varchar("slug", {
length: 255
}).notNull().unique(),
name: varchar("name", {
length: 255
}).notNull(),
description: text("description"),
active: boolean("active").notNull().default(true),
createdAt: timestamp("createdAt", {
mode: "date",
fsp: 3
}).defaultNow(),
updatedAt: timestamp("updatedAt", {
mode: "date",
fsp: 3
}).defaultNow(),
deletedAt: timestamp("deletedAt", {
mode: "date",
fsp: 3
})
}, (ct) => ({
nameIdx: index("name_idx").on(ct.name),
slugIdx: index("slug_idx").on(ct.slug),
organizationIdIdx: index("organizationId_idx").on(ct.organizationId)
}));
}
__name(getContributionTypesSchema, "getContributionTypesSchema");
function getContributionTypesRelationsSchema(mysqlTable) {
const contributionTypes = getContributionTypesSchema(mysqlTable);
return relations(contributionTypes, ({ many }) => ({}));
}
__name(getContributionTypesRelationsSchema, "getContributionTypesRelationsSchema");
export {
getContributionTypesSchema,
getContributionTypesRelationsSchema
};
//# sourceMappingURL=chunk-MP4CUWYC.js.map