Skip to content

Commit

Permalink
add dialect specific truncate snippet for sqlite (#806)
Browse files Browse the repository at this point in the history
  • Loading branch information
collinstevens authored Dec 16, 2023
1 parent fef1967 commit e89732a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion site/docs/getting-started/Summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,17 @@ const dialectSpecificCodeSnippets: Record<Dialect, string> = {
.execute()`,
}

const dialectSpecificTruncateSnippets: Record<Dialect, string> = {
postgresql: `await sql\`truncate table \${sql.table('person')}\`.execute(db)`,
mysql: `await sql\`truncate table \${sql.table('person')}\`.execute(db)`,
sqlite: `await sql\`delete from \${sql.table('person')}\`.execute(db)`,
}

export function Summary(props: PropsWithDialect) {
const dialect = props.dialect || 'postgresql'

const dialectSpecificCodeSnippet = dialectSpecificCodeSnippets[dialect]
const dialectSpecificTruncateSnippet = dialectSpecificTruncateSnippets[dialect]
const prettyDialectName = PRETTY_DIALECT_NAMES[dialect]

return (
Expand All @@ -66,7 +73,7 @@ ${dialectSpecificCodeSnippet}
})
afterEach(async () => {
await sql\`truncate table \${sql.table('person')}\`.execute(db)
${dialectSpecificTruncateSnippet}
})
after(async () => {
Expand Down

1 comment on commit e89732a

@vercel
Copy link

@vercel vercel bot commented on e89732a Dec 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

kysely – ./

kysely-kysely-team.vercel.app
kysely-git-master-kysely-team.vercel.app
kysely.dev
www.kysely.dev

Please sign in to comment.