node-crate: Add createIfNotExists; fix cut & paste error in project URL (#29747)

* Add createIfNotExists; fix cut & paste error in project URL

* Add test
This commit is contained in:
Greg Jednaszewski
2018-10-15 15:23:19 -04:00
committed by Sheetal Nandi
parent ad59680eed
commit ed9ad1949f
2 changed files with 7 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
// Type definitions for node-crate 2.0
// Project: https://github.com/arobson/rabbot
// Project: https://github.com/megastef/node-crate
// Definitions by: Greg Jednaszewski <https://github.com/gjednaszewski>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -30,6 +30,10 @@ declare namespace crate {
* Creates a table with the given schema.
*/
create: (schema: object) => Promise<DBResultObject>;
/**
* Creates a table if it doesn't already exist.
*/
createIfNotExists: (schema: object) => Promise<DBResultObject>;
/**
* Drops a table.
*/

View File

@@ -10,6 +10,8 @@ crate.insert('users', {id: 'test', password: 'password'});
crate.create({users: {id: 'string primary key', password: 'string'}});
crate.createIfNotExists({users: {id: 'string primary key', password: 'string'}});
crate.drop('users');
crate.update('users', {password: 'newPassword'}, "id = 'test'");