timestamps method

void timestamps({
  1. bool useCurrent = true,
  2. bool timezoneAware = false,
  3. bool nullable = false,
  4. int precision = 3,
})

Adds created_at and updated_at timestamps.

Implementation

void timestamps({
  bool useCurrent = true,
  bool timezoneAware = false,
  bool nullable = false,
  int precision = 3,
}) {
  final created = timestamp(
    'created_at',
    timezoneAware: timezoneAware,
    precision: precision,
  );
  final updated = timestamp(
    'updated_at',
    timezoneAware: timezoneAware,
    precision: precision,
  );
  if (useCurrent) {
    created.useCurrentTimestamp();
    updated.useCurrentTimestamp().useCurrentOnUpdate();
  }
  if (nullable) {
    created.nullable();
    updated.nullable();
  }
}