Skip to content

Commit aab8a02

Browse files
committed
implements deleteSchema
1 parent 8dac34e commit aab8a02

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/index.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,7 @@ ChainsqlAPI.prototype.beginTran = function () {
726726
this.transaction = true;
727727
return;
728728
}
729+
throw chainsqlError("connect is undefine or connect.address is undefine")
729730
}
730731

731732
function handleCommit(ChainSQL, object, resolve, reject) {
@@ -1366,6 +1367,27 @@ ChainsqlAPI.prototype.modifySchema = function(schemaInfo){
13661367
return this;
13671368
};
13681369

1370+
ChainsqlAPI.prototype.deleteSchema = function(schemaInfo){
1371+
1372+
let bValid = (schemaInfo !== undefined)
1373+
&& (schemaInfo.SchemaID !== undefined)
1374+
1375+
if(!bValid){
1376+
throw new Error("Invalid deleteSchema parameter");
1377+
}
1378+
1379+
var schemaDeleteTxJson = {
1380+
Account: this.connect.address,
1381+
SchemaID: schemaInfo.SchemaID,
1382+
TransactionType: 'SchemaDelete'
1383+
};
1384+
1385+
// 修改子链
1386+
this.schemaModifyTx = true;
1387+
this.payment = schemaDeleteTxJson;
1388+
return this;
1389+
};
1390+
13691391
function callback(data, callback) {
13701392

13711393
}

0 commit comments

Comments
 (0)