def visit_table(self, table):
"""sqlite is going to create multi-primary keys with just a UNIQUE index."""
self.append("\nCREATE TABLE " + table.fullname + "(")
separator = "\n"
have_pk = False
use_pks = len(table.primary_key) == 1
for column in table.columns:
self.append(separator)
separator = ", \n"
self.append("\t" + self.get_column_specification(column, override_pk=not use_pks))
if len(table.primary_key) > 1:
self.append(", \n")
# put all PRIMARY KEYS in a UNIQUE index
self.append("\tUNIQUE (%s)" % string.join([c.name for c in table.primary_key],', '))
self.append("\n)\n\n")
self.execute()
评论列表
文章目录