Repository navigation
repomap 1.4.0
-
Django models as a schema source for
db.repomap dbnow readsmodels.pyandmodels/packages alongside the existing sources:- classes subclassing
models.Modeldirectly, through an abstract base in the repository, or through a library base (AbstractUser,TimeStampedModel); abstract and proxy models emit no table, and multi-table inheritance gives the child a<parent>_ptr_idprimary key and only its own columns; - fields as columns, with
db_column,primary_key,null,uniqueanddb_indexhonoured; ForeignKeyandOneToOneFieldas foreign keys (<attr>_id, or the target field's column viato_field), resolving"self","app.Model"andsettings.AUTH_USER_MODEL;ManyToManyFieldas Django's implicit join table<db_table>_<field>(two foreign keys, a unique pair and an index) unlessthrough=names an explicit model;Meta.db_table(with%(app_label)s/%(class)sfilled in),Meta.indexes/Meta.constraints,unique_togetherandindex_together, including the backend index classes (GinIndex,BTreeIndex, …) and the ways a model reuses a base's Meta:class Meta(Base.Meta),indexes = [*Base.Meta.indexes, …]andindexes.extend(Base.Meta.indexes). The default table is<app_label>_<modelname>;- model usage (
Post.objects.filter(…)) links back to the table from any file that imports the model'smodels.py, like the other ORM sources.
On saleor (
repomap db --json): 122 tables (100 models and 22 implicit M2M join tables), 245 foreign keys, 1229 columns and 508 indexes. - classes subclassing