map method

  1. @override
Migration map(
  1. Map<String, dynamic> data, {
  2. String? tablePrefix,
})

Maps the given row returned by the database into the fitting data class.

Implementation

@override
Migration map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return Migration.fromDb(
    id: attachedDatabase.typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}id'])!,
    name: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}name'])!,
    start: attachedDatabase.typeMapping
        .read(DriftSqlType.dateTime, data['${effectivePrefix}start']),
    finish: attachedDatabase.typeMapping
        .read(DriftSqlType.dateTime, data['${effectivePrefix}finish']),
    migrationState: $MigrationsTable.$convertermigrationState.fromSql(
        attachedDatabase.typeMapping.read(
            DriftSqlType.int, data['${effectivePrefix}migration_state'])!),
  );
}