Skip to content

Commit d473330

Browse files
chore: wip
1 parent ec96958 commit d473330

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

examples/models/User.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const model = defineModel({
99
id: { validation: { rule: v.integer() } },
1010
email: { unique: true, validation: { rule: v.string() } },
1111
name: { validation: { rule: v.string() } },
12-
role: { validation: { rule: v.enum(['admin', 'member', 'guest'] as const) } },
1312
created_at: { validation: { rule: v.date() } },
1413
updated_at: { validation: { rule: v.date() } },
1514
},

examples/test-queries.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,29 @@ async function simpleMigration() {
3333
await executeMigration(migration)
3434
}
3535

36+
async function simpleSelectQuery() {
37+
const q = await db.selectFrom('users').executeTakeFirst()
38+
39+
console.warn('Results:', q)
40+
}
41+
42+
async function simpleInsertQuery() {
43+
// TODO: execute after insertion must return ids
44+
const q = await db.insertInto('users').values({ name: 'John Doe', email: '[email protected]', created_at: new Date() }).execute()
45+
46+
47+
console.warn('Results:', q)
48+
}
49+
3650
// Export for use in other files
3751
export {
3852
basicSelectQuery,
3953
db,
4054
meta,
4155
schema,
4256
simpleMigration,
57+
simpleSelectQuery,
58+
simpleInsertQuery,
4359
}
60+
61+
await simpleInsertQuery()

0 commit comments

Comments
 (0)