updateSchema method

Future<void> updateSchema(
  1. Schema schema
)
inherited

Replace the schema with a new version. This is for advanced use cases - typically the schema should just be specified once in the constructor.

Cannot be used while connected - this should only be called before connect.

Implementation

Future<void> updateSchema(Schema schema) async {
  schema.validate();

  await _activeGroup.syncConnectMutex.lock(() async {
    if (_abortActiveSync != null) {
      throw AssertionError('Cannot update schema while connected');
    }

    this.schema = schema;
    await database.writeLock((tx) => schema_logic.updateSchema(tx, schema));
  });
}