@magic-mustard/sqlsync
Version:
SQLSync simplifies database schema evolution by allowing a declarative approach to table management
25 lines (24 loc) • 1.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TableProcessor = void 0;
const namespace_1 = require("../namespace");
const create_table_processor_1 = require("./create.table.processor");
const alter_table_processor_1 = require("./alter.table.processor");
class TableProcessor extends namespace_1.Parser.AbstractProcessor {
constructor(file, migrations, state, contentBetweenFlags) {
super(file, migrations, state, contentBetweenFlags);
this.createTablesProcessor = new create_table_processor_1.CreateTablesProcessor(file, migrations, state, contentBetweenFlags);
this.alterTablesProcessor = new alter_table_processor_1.AlterTablesProcessor(file, migrations, state, contentBetweenFlags);
}
process() {
// Check for create table statements and process if they exist
if (this.createTablesProcessor.hasCreateTableStatements()) {
this.createTablesProcessor.process();
}
// Check for alter table statements and process if they exist
if (this.alterTablesProcessor.hasAlterTableStatements()) {
this.alterTablesProcessor.process();
}
}
}
exports.TableProcessor = TableProcessor;