pgUp.ts — drizzle-orm Source File
Architecture documentation for pgUp.ts, a typescript file in the drizzle-orm codebase. 14 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 466af62c_27ae_41b6_d841_1dc8334565a4["pgUp.ts"] cbf63853_6723_30fc_5ded_88a8944f77c4["pgSchema.ts"] 466af62c_27ae_41b6_d841_1dc8334565a4 --> cbf63853_6723_30fc_5ded_88a8944f77c4 c9abdae6_af01_af6f_d633_87497e6f810d["Column"] 466af62c_27ae_41b6_d841_1dc8334565a4 --> c9abdae6_af01_af6f_d633_87497e6f810d 8c180a70_cc77_6a9e_41a5_a78bc784f6d7["Index"] 466af62c_27ae_41b6_d841_1dc8334565a4 --> 8c180a70_cc77_6a9e_41a5_a78bc784f6d7 b5617e13_ea8f_6fe9_4a65_de1491ad2dee["PgSchema"] 466af62c_27ae_41b6_d841_1dc8334565a4 --> b5617e13_ea8f_6fe9_4a65_de1491ad2dee 35b59aa1_253e_bb2a_96df_2527f0f1a52a["PgSchemaV4"] 466af62c_27ae_41b6_d841_1dc8334565a4 --> 35b59aa1_253e_bb2a_96df_2527f0f1a52a 4a1eb8ee_4487_6fc2_8788_81fcda54b084["PgSchemaV5"] 466af62c_27ae_41b6_d841_1dc8334565a4 --> 4a1eb8ee_4487_6fc2_8788_81fcda54b084 92ddaaa0_ca89_6ee6_7ed2_b0cb3e59c5d2["PgSchemaV6"] 466af62c_27ae_41b6_d841_1dc8334565a4 --> 92ddaaa0_ca89_6ee6_7ed2_b0cb3e59c5d2 9f1a3924_0b26_874d_aa67_45481933835f["Table"] 466af62c_27ae_41b6_d841_1dc8334565a4 --> 9f1a3924_0b26_874d_aa67_45481933835f bce278eb_8ca9_25de_68d9_4aff736c5653["TableV5"] 466af62c_27ae_41b6_d841_1dc8334565a4 --> bce278eb_8ca9_25de_68d9_4aff736c5653 5847e5ae_7b4a_4b02_b68f_883ef88b3c1a["utils.ts"] 466af62c_27ae_41b6_d841_1dc8334565a4 --> 5847e5ae_7b4a_4b02_b68f_883ef88b3c1a 3f325b6b_14df_fa20_c5d7_83c98bc3d75c["prepareOutFolder"] 466af62c_27ae_41b6_d841_1dc8334565a4 --> 3f325b6b_14df_fa20_c5d7_83c98bc3d75c b18145b4_f05d_a9ae_4a8e_98368ec2cf0d["validateWithReport"] 466af62c_27ae_41b6_d841_1dc8334565a4 --> b18145b4_f05d_a9ae_4a8e_98368ec2cf0d 0f00c7dd_5eba_f1f8_c559_a99431086500["chalk"] 466af62c_27ae_41b6_d841_1dc8334565a4 --> 0f00c7dd_5eba_f1f8_c559_a99431086500 9a46d98d_eb2d_c1e4_a37b_506dd514a6a7["fs"] 466af62c_27ae_41b6_d841_1dc8334565a4 --> 9a46d98d_eb2d_c1e4_a37b_506dd514a6a7 style 466af62c_27ae_41b6_d841_1dc8334565a4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import chalk from 'chalk';
import { writeFileSync } from 'fs';
import {
Column,
Index,
PgSchema,
PgSchemaV4,
PgSchemaV5,
pgSchemaV5,
PgSchemaV6,
pgSchemaV6,
Table,
TableV5,
} from '../../serializer/pgSchema';
import { prepareOutFolder, validateWithReport } from '../../utils';
export const upPgHandler = (out: string) => {
const { snapshots } = prepareOutFolder(out, 'postgresql');
const report = validateWithReport(snapshots, 'postgresql');
report.nonLatest
.map((it) => ({
path: it,
raw: report.rawMap[it]!! as Record<string, any>,
}))
.forEach((it) => {
const path = it.path;
let resultV6 = it.raw;
if (it.raw.version === '5') {
resultV6 = updateUpToV6(it.raw);
}
const result = updateUpToV7(resultV6);
console.log(`[${chalk.green('✓')}] ${path}`);
writeFileSync(path, JSON.stringify(result, null, 2));
});
console.log("Everything's fine 🐶🔥");
};
export const updateUpToV6 = (json: Record<string, any>): PgSchemaV6 => {
const schema = pgSchemaV5.parse(json);
const tables = Object.fromEntries(
Object.entries(schema.tables).map((it) => {
const table = it[1];
const schema = table.schema || 'public';
return [`${schema}.${table.name}`, table];
}),
);
const enums = Object.fromEntries(
Object.entries(schema.enums).map((it) => {
const en = it[1];
return [
`public.${en.name}`,
{
name: en.name,
schema: 'public',
// ... (120 more lines)
Domain
Subdomains
Dependencies
Source
Frequently Asked Questions
What does pgUp.ts do?
pgUp.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleKit domain, CLIWorkflow subdomain.
What functions are defined in pgUp.ts?
pgUp.ts defines 4 function(s): upPgHandler, upPgHandlerV4toV5, updateUpToV6, updateUpToV7.
What does pgUp.ts depend on?
pgUp.ts imports 14 module(s): Column, Index, PgSchema, PgSchemaV4, PgSchemaV5, PgSchemaV6, Table, TableV5, and 6 more.
What files import pgUp.ts?
pgUp.ts is imported by 2 file(s): api.ts, schema.ts.
Where is pgUp.ts in the architecture?
pgUp.ts is located at drizzle-kit/src/cli/commands/pgUp.ts (domain: DrizzleKit, subdomain: CLIWorkflow, directory: drizzle-kit/src/cli/commands).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free