Skip to content

Commit

Permalink
Move DATABASE_MODE to environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
barbarah committed Sep 15, 2023
1 parent ee2fa79 commit 7e2e7de
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/datahub-data/src/db/connection.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import {Mode} from 'drizzle-orm/mysql-core';
import * as schema from './schema';
import {drizzle} from 'drizzle-orm/mysql2';
import mysql from 'mysql2/promise';
import {env} from 'node:process';

const poolConnection = mysql.createPool({
uri: process.env['DATABASE_URL'],
uri: env['DATABASE_URL'],
});

export default drizzle(poolConnection, {schema, mode: 'planetscale'});
export default drizzle(poolConnection, {
schema,
mode: (env['DATABASE_MODE'] || 'default') as Mode,
});

0 comments on commit 7e2e7de

Please sign in to comment.