Skip to content

Commit d1ca98c

Browse files
committed
chore: wip
1 parent d7b0c59 commit d1ca98c

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

.stacks/core/database/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export * from './factory'
22
export * from './migrations'
33
export * from './seeder'
4+
export * from './drivers/prisma'

.stacks/core/database/src/seeder/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PrismaClient } from '@prisma/client'
1+
import { client as DatabaseClient } from './drivers'
22
import { filesystem } from '@stacksjs/storage'
33
import type { Model } from '@stacksjs/types'
44

.stacks/core/slug/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import slugify from 'slugify'
22
import type { Model, ColumnOptions } from '@stacksjs/types'
3-
import { PrismaClient } from '@prisma/client'
3+
import { client as DatabaseClient } from '@stacksjs/database'
44

5-
const prisma = new PrismaClient()
5+
const database = new DatabaseClient()
66

77
export function generateSlug(model: Model, column: string, text: string): string {
88
// Find the field that corresponds to the given column name
@@ -28,7 +28,7 @@ export function generateSlug(model: Model, column: string, text: string): string
2828
}
2929

3030
async function addSlugColumn(modelName: string, columnName: string): Promise<void> {
31-
const model = (prisma as any)[modelName]
31+
const model = (database as any)[modelName]
3232
const fields = model._schema.fields
3333

3434
const originalField = fields.find((field: any) => field.dbName === columnName)
@@ -41,7 +41,7 @@ async function addSlugColumn(modelName: string, columnName: string): Promise<voi
4141
default: '',
4242
}
4343

44-
await prisma.$executeRaw(`ALTER TABLE "${modelName}" ADD COLUMN "${columnName}_slug" VARCHAR(255)`)
44+
await database.$executeRaw(`ALTER TABLE "${modelName}" ADD COLUMN "${columnName}_slug" VARCHAR(255)`)
4545

4646
const records = await model.findMany()
4747

0 commit comments

Comments
 (0)