compileReference static method

String compileReference(
  1. MigrationColumnReference ref
)

A REFERENCES of ref, of a table of the same database, as SQLite takes no schema there.

Implementation

static String compileReference(MigrationColumnReference ref) {
  var table = sql.quotePostgresPart(
    sql.unqualifiedPostgresName(ref.foreignTable),
  );
  var buf = StringBuffer(
    'REFERENCES $table(${sql.quotePostgresIdentifier(ref.foreignKey)})',
  );
  if (ref.behavior != null) buf.write(' ${ref.behavior!}');
  return buf.toString();
}