You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
run: "export AUTH_ORIGIN=http://localhost:3000 && export AUTH_SECRET=test123 && cd my-sidebase-app && npm run build && timeout 30 npm run preview || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )"
94
+
run: "cd my-sidebase-app && npm run build && timeout 30 npm run preview || ( [[ $? -eq 124 ]] && echo \"app started and did not exit within first 30 seconds, thats good\" )"
@@ -86,6 +92,84 @@ export function resetDatabase(databaseUrl?: string) {
86
92
}
87
93
`
88
94
95
+
constpglite=`/**
96
+
* Script that starts a postgres database using pg-gateway (https://github.com/supabase-community/pg-gateway) and pglite (https://github.com/electric-sql/pglite).
97
+
*
98
+
* We use this database for local development with prisma ORM. The script also supports creating a \`shadow-database\`, which is a second, separate database
99
+
* that prisma uses for certain commands, such as \`pnpm prisma migrate dev\`: https://www.prisma.io/docs/orm/prisma-migrate/understanding-prisma-migrate/shadow-database.
100
+
*
101
+
* To make use of the shadow-database add \`/prisma-shadow\` to the DSN you provide. This script will then spin up a second, in-memory-only database and connect you to it.
102
+
*
103
+
* This whole script approach is novel to us (before we used sqlite locally). Here is the PR that brought it all together: https://github.com/sidestream-tech/hanselmann-os/pull/3356
104
+
*/
105
+
import net from 'node:net'
106
+
import { unlinkSync, writeFileSync } from 'node:fs'
107
+
import { PGlite } from '@electric-sql/pglite'
108
+
import { fromNodeSocket } from 'pg-gateway/node'
109
+
import { join } from 'pathe'
110
+
111
+
// If env var is set, we write a file to disk once the server is done starting up. This file can then be used by other processes to check whether the database is ready
0 commit comments