Check if primary column on first _sync_table call

Checks if column is primary key column on table creation, before
attempting to add again as non-primary key column.
This commit is contained in:
emanuelfeld 2017-09-28 23:57:48 -04:00
parent 1fd19f37b9
commit 753d4a28d4

View File

@ -241,7 +241,8 @@ class Table(object):
autoincrement=increment) autoincrement=increment)
self._table.append_column(column) self._table.append_column(column)
for column in columns: for column in columns:
self._table.append_column(column) if not column.name == self._primary_id:
self._table.append_column(column)
self._table.create(self.db.executable, checkfirst=True) self._table.create(self.db.executable, checkfirst=True)
elif len(columns): elif len(columns):
with self.db.lock: with self.db.lock: