Skip to content

Commit dfe38e6

Browse files
committed
chore: fix typeorm example
1 parent c18e462 commit dfe38e6

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

apps/dev-playground/server/lakebase-examples/sequelize-example.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class Order
4444
let sequelize: Sequelize;
4545

4646
export async function setup() {
47+
// @ts-expect-error password property supports a function for Lakehouse OAuth tokens
4748
sequelize = new Sequelize({
4849
dialect: "postgres",
4950
...getLakebaseOrmConfig(),

apps/dev-playground/server/lakebase-examples/typeorm-example.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getLakebaseOrmConfig } from "@databricks/appkit";
1+
import { createLakebasePool, getLakebaseOrmConfig } from "@databricks/appkit";
22
import type { IAppRouter } from "shared";
33
import {
44
Column,
@@ -44,6 +44,12 @@ class Task {
4444
let dataSource: DataSource;
4545

4646
export async function setup() {
47+
// Create schema if not exists (TypeORM's synchronize doesn't create schemas)
48+
// See https://github.com/typeorm/typeorm/issues/3192
49+
const pool = createLakebasePool();
50+
await pool.query("CREATE SCHEMA IF NOT EXISTS typeorm_example");
51+
await pool.end();
52+
4753
dataSource = new DataSource({
4854
type: "postgres",
4955
...getLakebaseOrmConfig(),

0 commit comments

Comments
 (0)