mirror of
https://github.com/immich-app/immich.git
synced 2025-12-26 01:11:47 +03:00
27 lines
632 B
TypeScript
27 lines
632 B
TypeScript
import { SqlTransformer } from 'src/sql-tools/transformers/types';
|
|
import { DatabaseFunction } from 'src/sql-tools/types';
|
|
|
|
export const transformFunctions: SqlTransformer = (ctx, item) => {
|
|
switch (item.type) {
|
|
case 'FunctionCreate': {
|
|
return asFunctionCreate(item.function);
|
|
}
|
|
|
|
case 'FunctionDrop': {
|
|
return asFunctionDrop(item.functionName);
|
|
}
|
|
|
|
default: {
|
|
return false;
|
|
}
|
|
}
|
|
};
|
|
|
|
export const asFunctionCreate = (func: DatabaseFunction): string => {
|
|
return func.expression;
|
|
};
|
|
|
|
const asFunctionDrop = (functionName: string): string => {
|
|
return `DROP FUNCTION ${functionName};`;
|
|
};
|