runAndRecord method

  1. @override
Future<void> runAndRecord(
  1. PostgresSchema schema,
  2. String name,
  3. int batch
)
override

Runs schema, and records name in the migrations table in batch: in one transaction, if the database changes its tables in one.

Implementation

@override
Future<void> runAndRecord(PostgresSchema schema, String name, int batch) =>
    connection.runTx((ctx) async {
      await schema.run(ctx);
      await ctx.execute(
        Sql.named(
          'INSERT INTO migrations (batch, path) VALUES (@batch, @path)',
        ),
        parameters: {'batch': batch, 'path': name},
      );
    });