Skip to content

Commit

Permalink
fix(migrate): create separate client for migration
Browse files Browse the repository at this point in the history
  • Loading branch information
tfkhdyt committed Sep 27, 2023
1 parent ebdca5d commit ab4785d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/db/postgres/migrate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import { createClient } from '@libsql/client/.'
import { drizzle } from 'drizzle-orm/libsql'
import { migrate } from 'drizzle-orm/libsql/migrator'
import { db } from '.'

import config from '../../config/config'

console.log('Running migration...')

const client = createClient({
url: config.databaseUrl,
authToken: config.databaseAuthToken,
})
const db = drizzle(client)
await migrate(db, { migrationsFolder: './drizzle' })

console.log('Migrations is done')

0 comments on commit ab4785d

Please sign in to comment.