[CalendarServer-changes] [7405] CalendarServer/trunk/txdav/common/datastore/sql_tables.py
source_changes at macosforge.org
source_changes at macosforge.org
Fri Apr 29 14:28:39 PDT 2011
Revision: 7405
http://trac.macosforge.org/projects/calendarserver/changeset/7405
Author: glyph at apple.com
Date: 2011-04-29 14:28:39 -0700 (Fri, 29 Apr 2011)
Log Message:
-----------
add schema translation for all existing indexes.
Modified Paths:
--------------
CalendarServer/trunk/txdav/common/datastore/sql_tables.py
Modified: CalendarServer/trunk/txdav/common/datastore/sql_tables.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql_tables.py 2011-04-29 21:28:32 UTC (rev 7404)
+++ CalendarServer/trunk/txdav/common/datastore/sql_tables.py 2011-04-29 21:28:39 UTC (rev 7405)
@@ -254,7 +254,8 @@
# Oracle treats empty strings as NULLs, so we have to accept
# NULL values in columns of a string type. Other types should
# be okay though.
- and typeName not in ('varchar', 'nclob', 'char', 'nchar', 'nvarchar', 'nvarchar2') ):
+ and typeName not in ('varchar', 'nclob', 'char', 'nchar',
+ 'nvarchar', 'nvarchar2') ):
out.write(' not null')
if set([column.model]) in list(table.model.uniques()):
out.write(' unique')
@@ -265,6 +266,20 @@
out.write('\n);\n\n')
+ for (num, index) in enumerate(schema.model.indexes):
+ # Index names combine and repeat multiple table names and column names,
+ # so several of them conflict once oracle's length limit is applied.
+ # Luckily, index names don't matter to application code at all, so we
+ # can add a little disambiguating prefix without breaking anything.
+ # -glyph
+ uniqueIndexName = 'IDX_%d_%s' % (num, index.name)
+ shortIndexName = uniqueIndexName[:30]
+ shortTableName = index.table.name[:30]
+ out.write(
+ 'create index %s on %s (\n ' % (shortIndexName, shortTableName)
+ )
+ out.write(',\n '.join([column.name for column in index.columns]))
+ out.write('\n);\n\n')
if __name__ == '__main__':
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110429/eec8d21f/attachment.html>
More information about the calendarserver-changes
mailing list