()
| 203 | }); |
| 204 | |
| 205 | function getDatabaseSchema() { |
| 206 | if (!isValidDatabaseUrl(env.DATABASE_URL)) { |
| 207 | throw new Error("Invalid Database URL"); |
| 208 | } |
| 209 | |
| 210 | const databaseUrl = new URL(env.DATABASE_URL); |
| 211 | const schemaFromSearchParam = databaseUrl.searchParams.get("schema"); |
| 212 | |
| 213 | if (!schemaFromSearchParam) { |
| 214 | console.debug("❗ database schema unspecified, will default to `public` schema"); |
| 215 | return "public"; |
| 216 | } |
| 217 | |
| 218 | return schemaFromSearchParam; |
| 219 | } |
| 220 | |
| 221 | export const DATABASE_SCHEMA = singleton("DATABASE_SCHEMA", getDatabaseSchema); |
| 222 |
nothing calls this directly
no test coverage detected
searching dependent graphs…