classify method

  1. @override
DVSchemaChangeClass? classify(
  1. DVSchemaChange change
)
override

Implementation

@override
DVSchemaChangeClass? classify(DVSchemaChange change) => switch (change) {
  DVCreateTable() => DVSchemaChangeClass.instant,
  // SQLite refuses a NOT NULL column without a default outright; the only
  // way to one is rebuilding the table.
  DVAddColumn(nullable: false, defaultSql: null) =>
    DVSchemaChangeClass.blocking,
  DVAddColumn() => DVSchemaChangeClass.instant,
  // One writer at a time, and CREATE INDEX holds the write lock throughout.
  DVAddIndex() => DVSchemaChangeClass.blocking,
  DVAddNotNull() => DVSchemaChangeClass.blocking,
  DVChangeColumnType() => DVSchemaChangeClass.blocking,
  // RENAME COLUMN is 3.25; before it, a rename is a rebuild.
  DVRenameColumn() =>
    version >= const DVDatabaseServerVersion(3, 25)
        ? DVSchemaChangeClass.instant
        : DVSchemaChangeClass.blocking,
  // DROP COLUMN rewrites the table's content.
  DVDropColumn() => DVSchemaChangeClass.blocking,
  DVRawSchemaChange() => null,
};