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 {