Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dcousens committed Sep 26, 2022
1 parent 7b57782 commit 380307b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions examples/script/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export default config<TypeInfo>({
db: {
provider: 'sqlite',
url: process.env.DATABASE_URL || 'file:./keystone-example.db',

// this is called by Keystone on start, or when connect() is called in script.ts
onConnect: async context => {
console.log('(keystone.ts)', 'onConnect');
await context.db.Post.createOne({ data: { title: 'Created in onConnect' } });
Expand Down
4 changes: 2 additions & 2 deletions examples/script/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ async function main() {

console.log('(script.ts)', 'connect');

// if you don't call connect, db.onConnect will not be run
// but Prisma will automatically connect when Prisma is used
// if you don't call connect here, db.onConnect will not be run
// but, Prisma will automatically connect whenever Prisma is used
await connect();

const run = (Math.random() * 1e5) | 0;
Expand Down

0 comments on commit 380307b

Please sign in to comment.