51 lines
1.4 KiB
TypeScript
Raw Normal View History

/*
* Copyright (C) SapphireCode - All Rights Reserved
* This file is part of Snippeteer which is released under BSD-3-Clause.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, June 2020
*/
2020-06-28 16:55:44 +02:00
import { PatchAction } from '../classes/PatchAction';
import { ActionFactory } from './ActionFactory';
import { RenameColumn } from './RenameColumn';
import { AddTable } from './AddTable';
/*
* export { AddColumn } from './AddColumn';
* export { DropColumn } from './DropColumn';
* export { AddRelation } from './AddRelation';
* export { DropRelation } from './DropRelation';
* export { SetColumnType } from './SetColumnType';
* export { DropTable } from './DropTable';
* export { RenameTable } from './RenameTable';
* export { InsertData } from './InsertData';
* export { UpdateData } from './UpdateData';
* export { MutateDate } from './MutateDate';
* export { DeleteData } from './DeleteData';
*/
function assign_json (patch:PatchAction, json:string):PatchAction {
const obj = JSON.parse (json);
patch.assign_object (obj);
return patch;
}
function init ():void {
ActionFactory.register (
'rename_column',
(json:string) => assign_json (new RenameColumn ('', '', ''), json)
);
ActionFactory.register (
'add_table',
(json:string) => assign_json (new AddTable (''), json)
);
}
export {
init,
RenameColumn,
AddTable
};