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

Function fromJson

drizzle-kit/src/sqlgenerator.ts:4122–4144  ·  view source on GitHub ↗
(
	statements: JsonStatement[],
	dialect: Dialect,
	action?: 'push',
	json2?: SQLiteSchemaSquashed,
)

Source from the content-addressed store, hash-verified

4120convertors.push(new SingleStoreAlterTableAddPk());
4121
4122export function fromJson(
4123 statements: JsonStatement[],
4124 dialect: Dialect,
4125 action?: 'push',
4126 json2?: SQLiteSchemaSquashed,
4127) {
4128 const result = statements
4129 .flatMap((statement) => {
4130 const filtered = convertors.filter((it) => {
4131 return it.can(statement, dialect);
4132 });
4133
4134 const convertor = filtered.length === 1 ? filtered[0] : undefined;
4135
4136 if (!convertor) {
4137 return '';
4138 }
4139
4140 return convertor.convert(statement, json2, action);
4141 })
4142 .filter((it) => it !== '');
4143 return result;
4144}
4145
4146// blog.yo1.dog/updating-enum-values-in-postgresql-the-safe-and-easy-way/
4147// test case for enum altering

Callers 10

applyPgSnapshotsDiffFunction · 0.90
applyMysqlSnapshotsDiffFunction · 0.90
applySqliteSnapshotsDiffFunction · 0.90
applyLibSQLSnapshotsDiffFunction · 0.90
pgSuggestionsFunction · 0.90
logSuggestionsAndReturnFunction · 0.90
mysqlPushFunction · 0.90
logSuggestionsAndReturnFunction · 0.90

Calls 2

canMethod · 0.65
convertMethod · 0.45

Tested by

no test coverage detected