Skip to content

Commit 044804f

Browse files
committed
chore: wip
1 parent 82a1eaf commit 044804f

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

.stacks/core/types/src/database.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
import type { PrismaClient } from '@prisma/client'
2-
3-
export interface ColumnOptions {
4-
name: string
5-
type: string
6-
required?: boolean
7-
unique?: boolean
8-
default?: string
9-
}
10-
11-
export interface ModelOptions {
12-
name: string
13-
columns: ColumnOptions[]
14-
}
2+
import type { Model } from './model'
153

164
export type DatabaseClient = PrismaClient
175

@@ -29,7 +17,7 @@ export interface SchemaOptions {
2917

3018
export interface DatabaseDriver {
3119
client: DatabaseClient
32-
migrate: (models: ModelOptions, path: string, options?: SchemaOptions) => Promise<void>
20+
migrate: (models: Model, path: string, options?: SchemaOptions) => Promise<void>
3321
seed: (modelName: string, data: SeedData) => Promise<void>
3422
factory: (modelName: string, fileName: string, path: string) => Promise<void>
3523
}

.stacks/core/types/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export * from './layout'
1919
export * from './library'
2020
export * from './manifest'
2121
export * from './markdown'
22+
export * from './model'
2223
export * from './notifications'
2324
export * from './pages'
2425
export * from './payments'

.stacks/core/types/src/model.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Model.
3+
*/
4+
export interface Model {
5+
name: string
6+
searchable?: boolean // | IndexSettings,
7+
columns: ColumnOptions[]
8+
}
9+
10+
export interface ColumnOptions {
11+
name: string
12+
type: string
13+
required?: boolean
14+
unique?: boolean
15+
default?: string
16+
}

0 commit comments

Comments
 (0)