singleStoreSchemaSuggestions() — drizzle-orm Function Reference
Architecture documentation for the singleStoreSchemaSuggestions() function in migrate.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 252af4e5_a213_847a_f003_4fa5fee23398["singleStoreSchemaSuggestions()"] b14d3855_8cce_38c9_8952_a9d014c2fb1b["migrate.ts"] 252af4e5_a213_847a_f003_4fa5fee23398 -->|defined in| b14d3855_8cce_38c9_8952_a9d014c2fb1b style 252af4e5_a213_847a_f003_4fa5fee23398 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/src/cli/commands/migrate.ts lines 589–638
function singleStoreSchemaSuggestions(
curSchema: TypeOf<typeof singlestoreSchema>,
prevSchema: TypeOf<typeof singlestoreSchema>,
) {
const suggestions: string[] = [];
const usedSuggestions: string[] = [];
const suggestionTypes = {
// TODO: Check if SingleStore has serial type
serial: withStyle.errorWarning(
`We deprecated the use of 'serial' for SingleStore starting from version 0.20.0. In SingleStore, 'serial' is simply an alias for 'bigint unsigned not null auto_increment unique,' which creates all constraints and indexes for you. This may make the process less explicit for both users and drizzle-kit push commands`,
),
};
for (const table of Object.values(curSchema.tables)) {
for (const column of Object.values(table.columns)) {
if (column.type === 'serial') {
if (!usedSuggestions.includes('serial')) {
suggestions.push(suggestionTypes['serial']);
}
const uniqueForSerial = Object.values(
prevSchema.tables[table.name].uniqueConstraints,
).find((it) => it.columns[0] === column.name);
suggestions.push(
`\n`
+ withStyle.suggestion(
`We are suggesting to change ${
chalk.blue(
column.name,
)
} column in ${
chalk.blueBright(
table.name,
)
} table from serial to bigint unsigned\n\n${
chalk.blueBright(
`bigint("${column.name}", { mode: "number", unsigned: true }).notNull().autoincrement().unique(${
uniqueForSerial?.name ? `"${uniqueForSerial?.name}"` : ''
})`,
)
}`,
),
);
}
}
}
return suggestions;
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does singleStoreSchemaSuggestions() do?
singleStoreSchemaSuggestions() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/cli/commands/migrate.ts.
Where is singleStoreSchemaSuggestions() defined?
singleStoreSchemaSuggestions() is defined in drizzle-kit/src/cli/commands/migrate.ts at line 589.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free