implementing patches

This commit is contained in:
2020-04-19 18:49:07 +02:00
parent 858d778039
commit b7706f9a42
4 changed files with 45 additions and 6 deletions
lib/snippets/database

@ -2,4 +2,13 @@ import { Table } from './Table';
export class Database {
public tables: Array<Table> = [];
public get_table (name: string): Table|null {
for (const table of this.tables) {
if (table.name === name)
return table;
}
return null;
}
}

@ -0,0 +1,5 @@
import { Database } from './Database';
export interface PatchAction {
apply(db: Database): void;
}

@ -7,4 +7,13 @@ export class Table {
public constructor (name: string) {
this.name = name;
}
public get_column (name: string): Column|null {
for (const col of this.columns) {
if (col.name === name)
return col;
}
return null;
}
}