implementing patches
This commit is contained in:
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;
|
||||
}
|
||||
}
|
||||
|
5
lib/snippets/database/classes/PatchAction.ts
Normal file
5
lib/snippets/database/classes/PatchAction.ts
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user