Add new intermaps tables to mapping.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Tue, 17 Dec 2019 20:19:04 +0000 (20:19 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Tue, 17 Dec 2019 20:19:04 +0000 (20:19 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wrpylib/trunk@2851 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wrpylib/wrmwdb.py

index b88e492dae04ef05d61f7d65118d0dd7f26f6cc8..29e9c8c4e3c599d74cdd9df087fbaa362426501a 100644 (file)
@@ -5,6 +5,11 @@
 tables in MediaWiki easy. The module uses sqlalchemy to access the database.
 """
 from sqlalchemy import Table, Column, types, schema
 tables in MediaWiki easy. The module uses sqlalchemy to access the database.
 """
 from sqlalchemy import Table, Column, types, schema
+from sqlalchemy.dialects.mysql import ENUM
+
+
+intermaps_sledrun_id_type = types.Unicode(50)
+intermaps_sledrun_status_type = ENUM('open', 'closed', 'in_preparation', 'unknown')
 
 
 def wrreport_table(metadata):
 
 
 def wrreport_table(metadata):
@@ -159,3 +164,51 @@ def wrregioncache_table(metadata):
     Column("region_id", types.Integer, schema.ForeignKey('wrregin.id')),
     Column("page_id", types.Integer)
     )
     Column("region_id", types.Integer, schema.ForeignKey('wrregin.id')),
     Column("page_id", types.Integer)
     )
+
+
+def wrintermapssledrun_table(metadata):
+    """Returns the sqlalchemy table representing the "wrintermapssledrun" Winterrodeln table in MediaWiki.
+    Current table definition.
+    * version 1.5 (introduction)
+    :param metadata: metadata = sqlalchemy.MetaData()
+    """
+    return Table("wrintermapssledrun", metadata,
+        Column("intermaps_sledrun_id", intermaps_sledrun_id_type, primary_key=True),
+        Column("intermaps_sledrun_name", types.Unicode(255)),
+        Column("intermaps_region_id", types.Integer),
+        Column("intermaps_region_name", types.Unicode(255)),
+        Column("intermaps_country", types.Unicode(10)),
+        Column("wr_page_id", types.Integer, schema.ForeignKey("page.page_id")),
+        Column("wr_page_title", types.Unicode(255)),
+        Column("show_status", types.Boolean, nullable=False)
+    )
+
+
+def wrintermapsreport_table(metadata):
+    """Returns the sqlalchemy table representing the "wrintermapsreport" Winterrodeln table in MediaWiki.
+    Current table definition.
+    * version 1.5 (introduction)
+    :param metadata: metadata = sqlalchemy.MetaData()
+    """
+    return Table("wrintermapsreport", metadata,
+        Column("intermaps_sledrun_id", intermaps_sledrun_id_type, primary_key=True),
+        Column("status", intermaps_sledrun_status_type, nullable=False),
+        Column("last_update", types.DateTime, nullable=False),
+        Column("last_check", types.DateTime, nullable=False),
+        Column("utf_offset", types.Integer, nullable=False)
+    )
+
+
+def wrintermapsreporthistory_table(metadata):
+    """Returns the sqlalchemy table representing the "wrintermapsreporthistory" Winterrodeln table in MediaWiki.
+    Current table definition.
+    * version 1.5 (introduction)
+    :param metadata: metadata = sqlalchemy.MetaData()
+    """
+    return Table("wrintermapsreporthistory", metadata,
+        Column("id", types.Integer, primary_key=True),
+        Column("intermaps_sledrun_id", intermaps_sledrun_id_type, nullable=False),
+        Column("status", intermaps_sledrun_status_type, nullable=False),
+        Column("last_update", types.DateTime, nullable=False),
+        Column("utf_offset", types.Integer, nullable=False)
+    )