UNPKG

@sqlsmith/core

Version:

Core SQL schema merging engine with dependency resolution

37 lines 1.49 kB
export class CreateSequenceProcessor { getHandledTypes() { return ['sequence']; } canProcess(statement) { // TODO: The 'keyword' property on the Create type from node-sql-parser // doesn't seem to include 'sequence'. Using 'any' for now. return (statement?.type === 'create' && statement?.keyword === 'sequence'); } /** * Extracts sequence statements from the given AST. */ extractStatements(ast, filePath, _dialect) { const statements = []; const astArray = Array.isArray(ast) ? ast : [ast]; for (const statement of astArray) { if (this.canProcess(statement)) { // TODO: The Create type from node-sql-parser doesn't have a clear // property for the sequence name. Using 'any' for now based on // previous implementation. const sequenceName = statement.sequence?.[0]?.table; if (sequenceName) { statements.push({ type: 'sequence', name: sequenceName, dependsOn: [], // Sequences typically don't have dependencies filePath, content: '', // Will be filled by the file parser ast: statement, }); } } } return statements; } } //# sourceMappingURL=create-sequence-processor.js.map