Extend set of forbidden fields to include keywords from various database backends
Issue location: /dynamic_models/models.py:254 That is:
class ModelFieldSchema(GenericModel, GenericField): objects = ModelFieldSchemaManager() null = models.BooleanField(default=False) # issue1 unique = models.BooleanField(default=False) # issue2 max_length = models.PositiveIntegerField(null=True)
Problem description:
'null' and 'unique' are keywords in mysql grammar. In our strict DBA system, 'null' and 'unique' are forbidden to be column names.
Suggestion: code to be modified as follows.
class ModelFieldSchema(GenericModel, GenericField): objects = ModelFieldSchemaManager() null = models.BooleanField(default=False, db_column='is_null') # issue1 unique = models.BooleanField(default=False, db_column='is_unique') # issue2 max_length = models.PositiveIntegerField(null=True)
@Cindy0113 Finally following up on this...
I was thinking about programmatically calling into Django's system checks framework to perform many other checks on model errors and warnings. Does this handle your use case?