MCPcopy
hub / github.com/drizzle-team/drizzle-orm / startStudioPostgresServer

Function startStudioPostgresServer

drizzle-kit/src/api.ts:190–221  ·  view source on GitHub ↗
(
	imports: Record<string, unknown>,
	credentials: PostgresCredentials | {
		driver: 'pglite';
		client: PGlite;
	},
	options?: {
		host?: string;
		port?: number;
		casing?: CasingType;
	},
)

Source from the content-addressed store, hash-verified

188};
189
190export const startStudioPostgresServer = async (
191 imports: Record<string, unknown>,
192 credentials: PostgresCredentials | {
193 driver: 'pglite';
194 client: PGlite;
195 },
196 options?: {
197 host?: string;
198 port?: number;
199 casing?: CasingType;
200 },
201) => {
202 const { drizzleForPostgres } = await import('./serializer/studio');
203
204 const pgSchema: Record<string, Record<string, AnyPgTable>> = {};
205 const relations: Record<string, Relations> = {};
206
207 Object.entries(imports).forEach(([k, t]) => {
208 if (is(t, PgTable)) {
209 const schema = pgTableConfig(t).schema || 'public';
210 pgSchema[schema] = pgSchema[schema] || {};
211 pgSchema[schema][k] = t;
212 }
213
214 if (is(t, Relations)) {
215 relations[k] = t;
216 }
217 });
218
219 const setup = await drizzleForPostgres(credentials, pgSchema, relations, [], options?.casing);
220 await startServerFromSetup(setup, options);
221};
222
223// SQLite
224

Callers

nothing calls this directly

Calls 3

isFunction · 0.90
drizzleForPostgresFunction · 0.85
startServerFromSetupFunction · 0.85

Tested by

no test coverage detected