SchemaColumn.fromProperty constructor

SchemaColumn.fromProperty(
  1. ManagedPropertyDescription desc
)

Creates an instance of this type to mirror desc.

Implementation

SchemaColumn.fromProperty(ManagedPropertyDescription desc) {
  name = desc.name;

  if (desc is ManagedRelationshipDescription) {
    isPrimaryKey = false;
    relatedTableName = desc.destinationEntity.tableName;
    relatedColumnName = desc.destinationEntity.primaryKey;
    if (desc.deleteRule != null) {
      _deleteRule = deleteRuleStringForDeleteRule(desc.deleteRule!);
    }
  } else if (desc is ManagedAttributeDescription) {
    defaultValue = desc.defaultValue;
    isPrimaryKey = desc.isPrimaryKey;
  }

  _type = typeStringForType(desc.type!.kind);
  isNullable = desc.isNullable;
  autoincrement = desc.autoincrement;
  isUnique = desc.isUnique;
  isIndexed = desc.isIndexed;
}