Order move changelogs descendingly.
[zzz-pokedex.git] / pokedex / db / tables.py
index 958cfb7..177309a 100644 (file)
@@ -1375,7 +1375,7 @@ Machine.item = relation(Item)
 Machine.version_group = relation(VersionGroup)
 
 Move.changelog = relation(MoveChangelog,
-    order_by=MoveChangelog.changed_in_version_group_id.asc(),
+    order_by=MoveChangelog.changed_in_version_group_id.desc(),
     backref='move',
 )
 Move.contest_effect = relation(ContestEffect, backref='moves')
@@ -1578,9 +1578,10 @@ Type.foreign_names = relation(TypeName, backref='type')
 
 TypeName.language = relation(Language)
 
-Version.version_group = relation(VersionGroup, backref='versions')
+Version.version_group = relation(VersionGroup, back_populates='versions')
 Version.generation = association_proxy('version_group', 'generation')
 
+VersionGroup.versions = relation(Version, order_by=Version.id, back_populates='version_group')
 VersionGroup.generation = relation(Generation, backref='version_groups')
 VersionGroup.version_group_regions = relation(VersionGroupRegion, backref='version_group')
 VersionGroup.regions = association_proxy('version_group_regions', 'region')