register<T extends TableColumn> static method

Future<bool> register<T extends TableColumn>(
  1. List<T> fields, {
  2. required TranscationalExecutor executor,
  3. String? tableName,
  4. OnMigrate? onMigrate,
})

Implementation

static Future<bool> register<T extends TableColumn>(List<T> fields, {required TranscationalExecutor executor, String? tableName, OnMigrate? onMigrate}) async {
  assert(fields.isNotEmpty);
  if (TableProto.isRegisted<T>()) return false;
  final tab = TableProto._(fields, type: T, name: tableName, executor: executor);
  if (onMigrate != null) {
    await executor.transaction((e) async {
      await onMigrate.migrate(e, tab);
    });
  }
  return true;
}