mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 20:37:21 +00:00
26 lines
703 B
TypeScript
26 lines
703 B
TypeScript
import type { Kysely } from "kysely";
|
|
import { PostgresConnection, PostgresIntrospector, type PostgresConnectionConfig } from "../src";
|
|
|
|
export const info = {
|
|
host: "localhost",
|
|
port: 5430,
|
|
user: "postgres",
|
|
password: "postgres",
|
|
database: "bknd",
|
|
};
|
|
|
|
export function createConnection(config: PostgresConnectionConfig = {}) {
|
|
return new PostgresConnection({
|
|
...info,
|
|
...config,
|
|
});
|
|
}
|
|
|
|
export async function cleanDatabase(connection: PostgresConnection) {
|
|
const kysely = connection.kysely;
|
|
|
|
// drop all tables & create new schema
|
|
await kysely.schema.dropSchema("public").ifExists().cascade().execute();
|
|
await kysely.schema.createSchema("public").execute();
|
|
}
|