apply method

  1. @override
Future<void> apply(
  1. StmtMigration migration
)
inherited

Implementation

@override
Future<void> apply(StmtMigration migration) async {
  final statements = migration.statements;
  final version = migration.version;

  if (!kValidVersionExp.hasMatch(version)) {
    throw Exception(
      'Invalid migration version, must match $kValidVersionExp',
    );
  }

  await adapter.runInTransaction([
    ...statements,
    Statement(
      '''
INSERT INTO $migrationsTable (version, applied_at)
VALUES (${queryBuilder.makePositionalParam(1)}, ${queryBuilder.makePositionalParam(2)});''',
      [version, DateTime.now().millisecondsSinceEpoch],
    ),
  ]);
}