prepareMySqlSchema() — drizzle-orm Function Reference
Architecture documentation for the prepareMySqlSchema() function in studio.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD de02ead4_74a3_a892_2148_eccaf0bae967["prepareMySqlSchema()"] 82de12f8_a8ca_9d38_8da8_9ac945d81e01["studio.ts"] de02ead4_74a3_a892_2148_eccaf0bae967 -->|defined in| 82de12f8_a8ca_9d38_8da8_9ac945d81e01 72630e5c_93c3_75d3_29f3_af0928ebe15c["studio.handler()"] 72630e5c_93c3_75d3_29f3_af0928ebe15c -->|calls| de02ead4_74a3_a892_2148_eccaf0bae967 54221957_c725_0bfe_4345_4f3837d39296["safeRegister()"] de02ead4_74a3_a892_2148_eccaf0bae967 -->|calls| 54221957_c725_0bfe_4345_4f3837d39296 style de02ead4_74a3_a892_2148_eccaf0bae967 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/src/serializer/studio.ts lines 126–161
export const prepareMySqlSchema = async (path: string | string[]) => {
const imports = prepareFilenames(path);
const mysqlSchema: Record<string, Record<string, AnyMySqlTable>> = {
public: {},
};
const relations: Record<string, Relations> = {};
// files content as string
const files = imports.map((it, index) => ({
// get the file name from the path
name: it.split('/').pop() || `schema${index}.ts`,
content: fs.readFileSync(it, 'utf-8'),
}));
const { unregister } = await safeRegister();
for (let i = 0; i < imports.length; i++) {
const it = imports[i];
const i0: Record<string, unknown> = require(`${it}`);
const i0values = Object.entries(i0);
i0values.forEach(([k, t]) => {
if (is(t, MySqlTable)) {
const schema = mysqlTableConfig(t).schema || 'public';
mysqlSchema[schema][k] = t;
}
if (is(t, Relations)) {
relations[k] = t;
}
});
}
unregister();
return { schema: mysqlSchema, relations, files };
};
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does prepareMySqlSchema() do?
prepareMySqlSchema() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/serializer/studio.ts.
Where is prepareMySqlSchema() defined?
prepareMySqlSchema() is defined in drizzle-kit/src/serializer/studio.ts at line 126.
What does prepareMySqlSchema() call?
prepareMySqlSchema() calls 1 function(s): safeRegister.
What calls prepareMySqlSchema()?
prepareMySqlSchema() is called by 1 function(s): studio.handler.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free