From aa27c281e463428b4fe92d2b90b5710101618d09 Mon Sep 17 00:00:00 2001 From: ntr Date: Fri, 28 Dec 2018 19:20:47 +1100 Subject: [PATCH] zones migration --- ops/migrations/20181228162012_zones.js | 28 ++++++++++++++++++++++++++ server/src/rpc.rs | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 ops/migrations/20181228162012_zones.js diff --git a/ops/migrations/20181228162012_zones.js b/ops/migrations/20181228162012_zones.js new file mode 100644 index 00000000..9b66e980 --- /dev/null +++ b/ops/migrations/20181228162012_zones.js @@ -0,0 +1,28 @@ +exports.up = async knex => { + await knex.schema.createTable('zones', async (table) => { + table.uuid('id').primary(); + table.index('id'); + table.timestamps(); + + table.binary('data').notNullable(); + + table.boolean('active') + .defaultTo(true) + .notNullable(); + + table.uuid('account').notNullable() + table.foreign('account') + .references('id') + .inTable('accounts') + .onDelete('CASCADE'); + + table.index('account'); + + await knex.schema.raw( + // eslint-disable-next-line max-len + 'CREATE UNIQUE INDEX zones_account_active ON zones (account) WHERE active = true;' + ); + }); +}; + +exports.down = async () => {}; \ No newline at end of file diff --git a/server/src/rpc.rs b/server/src/rpc.rs index 5a2b0443..9c46dae9 100644 --- a/server/src/rpc.rs +++ b/server/src/rpc.rs @@ -316,7 +316,7 @@ impl Rpc { return Ok(cryps_list); } - fn zone_create(data: Vec, tx: &mut Transaction, account: Account, _client: &mut WebSocket) -> Result { + fn zone_create(_data: Vec, tx: &mut Transaction, account: Account, _client: &mut WebSocket) -> Result { // let _msg = from_slice::(&data).or(Err(err_msg("invalid params")))?; let response = RpcResponse {