Source

trac-ticketlinks / trac / db_default.py

Diff from to

trac/db_default.py

 from trac.db import Table, Column, Index
 
 # Database version identifier. Used for automatic upgrades.
-db_version = 22
+db_version = 27
 
 def __mkreports(reports):
     """Utility function used to create report data in same syntax as the
         Column('authenticated', type='int'),
         Column('name'),
         Column('value')],
+    Table('cache', key='id')[
+        Column('id'),
+        Column('generation', type='int')],
 
     # Attachments
     Table('attachment', key=('type', 'id', 'filename'))[
         Column('id'),
         Column('filename'),
         Column('size', type='int'),
-        Column('time', type='int'),
+        Column('time', type='int64'),
         Column('description'),
         Column('author'),
         Column('ipnr')],
     Table('wiki', key=('name', 'version'))[
         Column('name'),
         Column('version', type='int'),
-        Column('time', type='int'),
+        Column('time', type='int64'),
         Column('author'),
         Column('ipnr'),
         Column('text'),
         Index(['time'])],
 
     # Version control cache
-    Table('revision', key='rev')[
-        Column('rev'),
-        Column('time', type='int'),
+    Table('repository', key=('id', 'name'))[
+        Column('id', type='int'),
+        Column('name'),
+        Column('value')],
+    Table('revision', key=('repos', 'rev'))[
+        Column('repos', type='int'),
+        Column('rev', key_size=20),
+        Column('time', type='int64'),
         Column('author'),
         Column('message'),
-        Index(['time'])],
-    Table('node_change', key=('rev', 'path', 'change_type'))[
-        Column('rev'),
-        Column('path'),
+        Index(['repos', 'time'])],
+    Table('node_change', key=('repos', 'rev', 'path', 'change_type'))[
+        Column('repos', type='int'),
+        Column('rev', key_size=20),
+        Column('path', key_size=255),
         Column('node_type', size=1),
-        Column('change_type', size=1),
+        Column('change_type', size=1, key_size=2),
         Column('base_path'),
         Column('base_rev'),
-        Index(['rev'])],
+        Index(['repos', 'rev'])],
 
     # Ticket system
     Table('ticket', key='id')[
         Column('id', auto_increment=True),
         Column('type'),
-        Column('time', type='int'),
-        Column('changetime', type='int'),
+        Column('time', type='int64'),
+        Column('changetime', type='int64'),
         Column('component'),
         Column('severity'),
         Column('priority'),
         Index(['status'])],    
     Table('ticket_change', key=('ticket', 'time', 'field'))[
         Column('ticket', type='int'),
-        Column('time', type='int'),
+        Column('time', type='int64'),
         Column('author'),
         Column('field'),
         Column('oldvalue'),
         Column('description')],
     Table('milestone', key='name')[
         Column('name'),
-        Column('due', type='int'),
-        Column('completed', type='int'),
+        Column('due', type='int64'),
+        Column('completed', type='int64'),
         Column('description')],
     Table('version', key='name')[
         Column('name'),
-        Column('time', type='int'),
+        Column('time', type='int64'),
         Column('description')],
 
     # Report system
 
 # (table, (column1, column2), ((row1col1, row1col2), (row2col1, row2col2)))
 def get_data(db):
-   return (('component',
-             ('name', 'owner'),
-               (('component1', 'somebody'),
-                ('component2', 'somebody'))),
-           ('milestone',
-             ('name', 'due', 'completed'),
-               (('milestone1', 0, 0),
-                ('milestone2', 0, 0),
-                ('milestone3', 0, 0),
-                ('milestone4', 0, 0))),
-           ('version',
-             ('name', 'time'),
-               (('1.0', 0),
-                ('2.0', 0))),
-           ('enum',
-             ('type', 'name', 'value'),
-               (('resolution', 'fixed', 1),
-                ('resolution', 'invalid', 2),
-                ('resolution', 'wontfix', 3),
-                ('resolution', 'duplicate', 4),
-                ('resolution', 'worksforme', 5),
-                ('priority', 'blocker', 1),
-                ('priority', 'critical', 2),
-                ('priority', 'major', 3),
-                ('priority', 'minor', 4),
-                ('priority', 'trivial', 5),
-                ('ticket_type', 'defect', 1),
-                ('ticket_type', 'enhancement', 2),
-                ('ticket_type', 'task', 3))),
-           ('permission',
-             ('username', 'action'),
-               (('anonymous', 'LOG_VIEW'),
-                ('anonymous', 'FILE_VIEW'),
-                ('anonymous', 'WIKI_VIEW'),
-                ('authenticated', 'WIKI_CREATE'),
-                ('authenticated', 'WIKI_MODIFY'),
-                ('anonymous', 'SEARCH_VIEW'),
-                ('anonymous', 'REPORT_VIEW'),
-                ('anonymous', 'REPORT_SQL_VIEW'),
-                ('anonymous', 'TICKET_VIEW'),
-                ('authenticated', 'TICKET_CREATE'),
-                ('authenticated', 'TICKET_MODIFY'),
-                ('anonymous', 'BROWSER_VIEW'),
-                ('anonymous', 'TIMELINE_VIEW'),
-                ('anonymous', 'CHANGESET_VIEW'),
-                ('anonymous', 'ROADMAP_VIEW'),
-                ('anonymous', 'MILESTONE_VIEW'))),
-           ('system',
-             ('name', 'value'),
-               (('database_version', str(db_version)),
-                ('initial_database_version', str(db_version)),
-                ('youngest_rev', ''))),
-           ('report',
-             ('author', 'title', 'query', 'description'),
-               __mkreports(get_reports(db))))
+    return (('component',
+              ('name', 'owner'),
+                (('component1', 'somebody'),
+                 ('component2', 'somebody'))),
+            ('milestone',
+              ('name', 'due', 'completed'),
+                (('milestone1', 0, 0),
+                 ('milestone2', 0, 0),
+                 ('milestone3', 0, 0),
+                 ('milestone4', 0, 0))),
+            ('version',
+              ('name', 'time'),
+                (('1.0', 0),
+                 ('2.0', 0))),
+            ('enum',
+              ('type', 'name', 'value'),
+                (('resolution', 'fixed', 1),
+                 ('resolution', 'invalid', 2),
+                 ('resolution', 'wontfix', 3),
+                 ('resolution', 'duplicate', 4),
+                 ('resolution', 'worksforme', 5),
+                 ('priority', 'blocker', 1),
+                 ('priority', 'critical', 2),
+                 ('priority', 'major', 3),
+                 ('priority', 'minor', 4),
+                 ('priority', 'trivial', 5),
+                 ('ticket_type', 'defect', 1),
+                 ('ticket_type', 'enhancement', 2),
+                 ('ticket_type', 'task', 3))),
+            ('permission',
+              ('username', 'action'),
+                (('anonymous', 'LOG_VIEW'),
+                 ('anonymous', 'FILE_VIEW'),
+                 ('anonymous', 'WIKI_VIEW'),
+                 ('authenticated', 'WIKI_CREATE'),
+                 ('authenticated', 'WIKI_MODIFY'),
+                 ('anonymous', 'SEARCH_VIEW'),
+                 ('anonymous', 'REPORT_VIEW'),
+                 ('anonymous', 'REPORT_SQL_VIEW'),
+                 ('anonymous', 'TICKET_VIEW'),
+                 ('authenticated', 'TICKET_CREATE'),
+                 ('authenticated', 'TICKET_MODIFY'),
+                 ('anonymous', 'BROWSER_VIEW'),
+                 ('anonymous', 'TIMELINE_VIEW'),
+                 ('anonymous', 'CHANGESET_VIEW'),
+                 ('anonymous', 'ROADMAP_VIEW'),
+                 ('anonymous', 'MILESTONE_VIEW'))),
+            ('system',
+              ('name', 'value'),
+                (('database_version', str(db_version)),
+                 ('initial_database_version', str(db_version)))),
+            ('report',
+              ('author', 'title', 'query', 'description'),
+                __mkreports(get_reports(db))))