Renamed to_title to dbkay_to_title and improved docstring.
[philipp/winterrodeln/wrpylib.git] / wrpylib / wrmwdb.py
index 761a8db3c500ea76f08c2ccd42278a672818ccd8..bcd9d34ced4eebb35134e9c9ae9700c7d8850031 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.6
+#!/usr/bin/python3.4
 # -*- coding: iso-8859-15 -*-
 # $Id$
 # $HeadURL$
@@ -14,6 +14,7 @@ def wrreport_table(metadata):
     * version 1.2
     * version 1.3 (no changes)
     * version 1.4 (no changes)
+    * version 1.5 added time_report
     :param metadata: metadata = sqlalchemy.MetaData()
     """
     return Table("wrreport", metadata,
@@ -21,6 +22,7 @@ def wrreport_table(metadata):
     Column("page_id", types.Integer, schema.ForeignKey('wrsledruncache.page_id')),
     Column("page_title", types.Unicode(255), nullable=False),
     Column("date_report", types.Date),
+    Column("time_report", types.Time),
     Column("date_entry", types.DateTime, nullable=False),
     Column("date_invalid", types.DateTime),
     Column("condition", types.Integer),
@@ -35,6 +37,7 @@ def wrreport_table(metadata):
     Column("delete_person_userid", types.Integer),
     Column("delete_person_username", types.Unicode(30)),
     Column("delete_reason_public", types.Unicode),
+    Column("delete_invisible", types.Boolean),
     )
 
 
@@ -45,8 +48,9 @@ def wrsledruncache_table(metadata):
     :param metadata: metadata = sqlalchemy.MetaData()
     """
     return Table("wrsledruncache", metadata,
-    Column("page_id", types.Integer, primary_key=True),
+    Column("page_id", types.Integer, schema.ForeignKey('wrreportcache.page_id'), primary_key=True),
     Column("page_title", types.Unicode(255)),
+    Column("name_url", types.Unicode(255)),
     Column("position_latitude", types.Float),
     Column("position_longitude", types.Float),
     Column("top_latitude", types.Float),
@@ -95,6 +99,7 @@ def wrinncache_table(metadata):
     Column("position_latitude", types.Float),
     Column("position_longitude", types.Float),
     Column("position_elevation", types.Integer),
+    Column("operator", types.Unicode(255)),
     Column("seats", types.Integer),
     Column("overnight", types.Boolean),
     Column("overnight_comment", types.Unicode(255)),
@@ -121,13 +126,38 @@ def wrreportcache_table(metadata):
     return Table("wrreportcache", metadata,
     Column("page_id", types.Integer, primary_key=True),
     Column("page_title", types.Unicode(255), nullable=False),
-    Column("report_id", types.Integer),
-    Column("report_date_report", types.Date),
-    Column("report_condition", types.Integer),
-    Column("report_description", types.Unicode),
-    Column("report_author_name", types.Unicode(30)),
-    Column("report_author_username", types.Unicode(30)),
-    Column("reports_xml", types.Unicode),
+    Column("report_id", types.Integer, schema.ForeignKey('wrreport.id')),
+    Column("date_report", types.Date),
+    Column("condition", types.Integer),
+    Column("description", types.Unicode),
+    Column("author_name", types.Unicode(30)),
+    Column("author_username", types.Unicode(30))
     )
 
 
+def wrregion_table(metadata):
+    """Returns the sqlalchemy Table representing the "wrregion" Winterrodeln table in MediaWiki.
+    Current table definition.
+    * version 1.5 (introduction)
+    :param metadata: metadata = sqlalchemy.MetaData()
+    """
+    return Table("wrregion", metadata,
+    Column("id", types.Integer, primary_key=True),
+    Column("name", types.Unicode(50)),
+    Column("page_id", types.Integer),
+    Column("border", types.Binary) # MultiPolygon(2, 4326)
+    )
+
+
+def wrregioncache_table(metadata):
+    """Returns the sqlalchemy Table representing the "wrregioncache" Winterrodeln table in MediaWiki.
+    Current table definition.
+    * version 1.5 (introduction)
+    :param metadata: metadata = sqlalchemy.MetaData()
+    """
+    return Table("wrregioncache", metadata,
+    Column("id", types.Integer, primary_key=True),
+    Column("region_id", types.Integer, schema.ForeignKey('wrregin.id')),
+    Column("page_id", types.Integer)
+    )
+