Home / Function/ studio.handler() — drizzle-orm Function Reference

studio.handler() — drizzle-orm Function Reference

Architecture documentation for the studio.handler() function in schema.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  72630e5c_93c3_75d3_29f3_af0928ebe15c["studio.handler()"]
  5bf76609_579e_d312_b33b_ab5b8b683111["schema.ts"]
  72630e5c_93c3_75d3_29f3_af0928ebe15c -->|defined in| 5bf76609_579e_d312_b33b_ab5b8b683111
  f2f9c6b8_d549_9373_9f11_ab0b6ee7eea1["assertOrmCoreVersion()"]
  72630e5c_93c3_75d3_29f3_af0928ebe15c -->|calls| f2f9c6b8_d549_9373_9f11_ab0b6ee7eea1
  773f4a96_2112_a02f_6216_ecef4a99527a["assertPackages()"]
  72630e5c_93c3_75d3_29f3_af0928ebe15c -->|calls| 773f4a96_2112_a02f_6216_ecef4a99527a
  bba60536_c878_a6e0_ec15_aaeef744e8f2["assertStudioNodeVersion()"]
  72630e5c_93c3_75d3_29f3_af0928ebe15c -->|calls| bba60536_c878_a6e0_ec15_aaeef744e8f2
  c0073ae8_c7f4_3872_09e0_5c7266fa8ffe["prepareStudioConfig()"]
  72630e5c_93c3_75d3_29f3_af0928ebe15c -->|calls| c0073ae8_c7f4_3872_09e0_5c7266fa8ffe
  bc2114db_3ee1_5e98_347a_e99ec7dcab98["ormVersionGt()"]
  72630e5c_93c3_75d3_29f3_af0928ebe15c -->|calls| bc2114db_3ee1_5e98_347a_e99ec7dcab98
  071bfc71_ad06_c0c4_cba2_360298dd4b47["assertUnreachable()"]
  72630e5c_93c3_75d3_29f3_af0928ebe15c -->|calls| 071bfc71_ad06_c0c4_cba2_360298dd4b47
  0d28bd98_0942_3298_4b65_820dc501377d["preparePgSchema()"]
  72630e5c_93c3_75d3_29f3_af0928ebe15c -->|calls| 0d28bd98_0942_3298_4b65_820dc501377d
  f115fdf8_009e_f0a5_2e08_c650dffd2496["drizzleForPostgres()"]
  72630e5c_93c3_75d3_29f3_af0928ebe15c -->|calls| f115fdf8_009e_f0a5_2e08_c650dffd2496
  de02ead4_74a3_a892_2148_eccaf0bae967["prepareMySqlSchema()"]
  72630e5c_93c3_75d3_29f3_af0928ebe15c -->|calls| de02ead4_74a3_a892_2148_eccaf0bae967
  faf342d9_5e62_6e76_b201_9e470cfbdaa4["drizzleForMySQL()"]
  72630e5c_93c3_75d3_29f3_af0928ebe15c -->|calls| faf342d9_5e62_6e76_b201_9e470cfbdaa4
  102b5c78_8ca8_423e_083d_8ea0d14cc0f1["prepareSQLiteSchema()"]
  72630e5c_93c3_75d3_29f3_af0928ebe15c -->|calls| 102b5c78_8ca8_423e_083d_8ea0d14cc0f1
  1a968317_891c_454b_77a6_20e6f61521b5["drizzleForSQLite()"]
  72630e5c_93c3_75d3_29f3_af0928ebe15c -->|calls| 1a968317_891c_454b_77a6_20e6f61521b5
  5f41c0fa_3d50_95fc_cac3_007d8078aa47["drizzleForLibSQL()"]
  72630e5c_93c3_75d3_29f3_af0928ebe15c -->|calls| 5f41c0fa_3d50_95fc_cac3_007d8078aa47
  style 72630e5c_93c3_75d3_29f3_af0928ebe15c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/cli/schema.ts lines 662–804

	handler: async (opts) => {
		await assertOrmCoreVersion();
		await assertPackages('drizzle-orm');

		assertStudioNodeVersion();

		const {
			dialect,
			schema: schemaPath,
			port,
			host,
			credentials,
			casing,
		} = await prepareStudioConfig(opts);

		const {
			drizzleForPostgres,
			preparePgSchema,
			prepareMySqlSchema,
			drizzleForMySQL,
			prepareSQLiteSchema,
			drizzleForSQLite,
			prepareSingleStoreSchema,
			drizzleForSingleStore,
			drizzleForLibSQL,
		} = await import('../serializer/studio');

		let setup: Setup;
		try {
			if (dialect === 'postgresql') {
				if ('driver' in credentials) {
					const { driver } = credentials;
					if (driver === 'aws-data-api') {
						if (!(await ormVersionGt('0.30.10'))) {
							console.log(
								"To use 'aws-data-api' driver - please update drizzle-orm to the latest version",
							);
							process.exit(1);
						}
					} else if (driver === 'pglite') {
						if (!(await ormVersionGt('0.30.6'))) {
							console.log(
								"To use 'pglite' driver - please update drizzle-orm to the latest version",
							);
							process.exit(1);
						}
					} else {
						assertUnreachable(driver);
					}
				}

				const { schema, relations, files } = schemaPath
					? await preparePgSchema(schemaPath)
					: { schema: {}, relations: {}, files: [] };
				setup = await drizzleForPostgres(credentials, schema, relations, files, casing);
			} else if (dialect === 'mysql') {
				const { schema, relations, files } = schemaPath
					? await prepareMySqlSchema(schemaPath)
					: { schema: {}, relations: {}, files: [] };
				setup = await drizzleForMySQL(credentials, schema, relations, files, casing);
			} else if (dialect === 'sqlite') {
				const { schema, relations, files } = schemaPath
					? await prepareSQLiteSchema(schemaPath)
					: { schema: {}, relations: {}, files: [] };
				setup = await drizzleForSQLite(credentials, schema, relations, files, casing);
			} else if (dialect === 'turso') {
				const { schema, relations, files } = schemaPath
					? await prepareSQLiteSchema(schemaPath)
					: { schema: {}, relations: {}, files: [] };
				setup = await drizzleForLibSQL(credentials, schema, relations, files, casing);
			} else if (dialect === 'singlestore') {
				const { schema, relations, files } = schemaPath
					? await prepareSingleStoreSchema(schemaPath)
					: { schema: {}, relations: {}, files: [] };
				setup = await drizzleForSingleStore(
					credentials,
					schema,
					relations,
					files,
					casing,
				);

Domain

Subdomains

Frequently Asked Questions

What does studio.handler() do?
studio.handler() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/cli/schema.ts.
Where is studio.handler() defined?
studio.handler() is defined in drizzle-kit/src/cli/schema.ts at line 662.
What does studio.handler() call?
studio.handler() calls 18 function(s): assertOrmCoreVersion, assertPackages, assertStudioNodeVersion, assertUnreachable, certs, drizzleForLibSQL, drizzleForMySQL, drizzleForPostgres, and 10 more.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free