Fix import on PostgreSQL
Database.py : fillDefaultData() Remove manual 'id' from INSERT command. In database schema, TourneyTypes.id is a primary key and thus autoincrement. In postgres, autoincrements are implemented as sequences - inserting a value "manually" bypasses the sequence generation, which resulted in a remarkably weird error. Namely, upon the first hand to import, the insert fails due to primary key violation. The default value from an unused sequence is 1, but a row with such an id already exists. The solution is to create the single row of default data values with unspecified TourneyTypes.id, hence allowing postgres to generate the correct id from the sequence. This way the import works again.
This commit is contained in:
parent
df71dcf2c7
commit
6f536d29e7
|
@ -1012,9 +1012,9 @@ class Database:
|
|||
if self.backend == self.SQLITE:
|
||||
c.execute("INSERT INTO TourneyTypes (id, siteId, buyin, fee) VALUES (NULL, 1, 0, 0);")
|
||||
else:
|
||||
c.execute("""insert into TourneyTypes(id, siteId, buyin, fee, maxSeats, knockout
|
||||
c.execute("""insert into TourneyTypes(siteId, buyin, fee, maxSeats, knockout
|
||||
,rebuyOrAddon, speed, headsUp, shootout, matrix)
|
||||
values (1, 1, 0, 0, 0, False, False, null, False, False, False);""")
|
||||
values (1, 0, 0, 0, False, False, null, False, False, False);""")
|
||||
|
||||
#end def fillDefaultData
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user