renderTableOptions method

  1. @override
List<String> renderTableOptions(
  1. String tableName, {
  2. String? engine,
  3. String? charset,
  4. String? collation,
  5. String? comment,
  6. int? autoIncrement,
})
override

Renders table-level options set through TableDefinition (engine, charset, collation, comment, auto-increment seed). Most of these are MySQL-only; adapters return an empty list for options their engine has no equivalent for, so a migration stays portable across drivers.

Implementation

@override
List<String> renderTableOptions(
  String tableName, {
  String? engine,
  String? charset,
  String? collation,
  String? comment,
  int? autoIncrement,
}) {
  final options = <String>[];
  if (engine != null) options.add('ENGINE=$engine');
  if (charset != null) options.add('DEFAULT CHARSET=$charset');
  if (collation != null) options.add('COLLATE=$collation');
  if (comment != null) options.add('COMMENT=${formatValue(comment)}');
  if (autoIncrement != null) options.add('AUTO_INCREMENT=$autoIncrement');

  if (options.isEmpty) return const [];
  return ['ALTER TABLE ${escapeIdentifier(tableName)} ${options.join(', ')}'];
}