Revert "sqlExport: Fix missing transactions by making whole row unique"

This reverts commit 6c862b9fb41f863cfc5d0ef4ffc863c4fe43d9fd.

Turns out that doesn't work, and mariadb was just silently failing.
Reopens #2.
This commit is contained in:
Adam Goldsmith 2020-03-14 15:58:35 -04:00
parent 74827ac9ad
commit 925e1abe80
2 changed files with 4 additions and 5 deletions

View File

@ -72,9 +72,7 @@ try:
c.execute("CREATE TABLE IF NOT EXISTS transactions (" + c.execute("CREATE TABLE IF NOT EXISTS transactions (" +
createDefinitionsFromTableMap(tableMapping['transactions']) + createDefinitionsFromTableMap(tableMapping['transactions']) +
", UNIQUE (" + ", CONSTRAINT `fk_member_uid` FOREIGN KEY (uid) REFERENCES members(uid));")
','.join(f'`{k}`' for k in tableMapping['transactions'].keys()) +
"), FOREIGN KEY (uid) REFERENCES members(uid));")
#-- FOREIGN KEY event_id REFERENCES event eid #-- FOREIGN KEY event_id REFERENCES event eid
c.execute("""CREATE TABLE IF NOT EXISTS labels ( c.execute("""CREATE TABLE IF NOT EXISTS labels (

View File

@ -78,8 +78,9 @@ members:
transactions: transactions:
'sid': {type: CHAR(27)} 'sid': {type: CHAR(27)}
'uid': {type: CHAR(24)} 'uid': {type: CHAR(24)}
'timestamp': {type: 'INT(11)', source: '_dp'} # TODO: should be a real timestamp? # TODO: this is a terrible PK
'type': {type: 'VARCHAR(24)', source: 'Transaction Type'} 'timestamp': {type: 'INT(11) PRIMARY KEY', source: '_dp'} # TODO: should be a real timestamp?
'type': {source: 'Transaction Type'}
'sum': {type: 'DECIMAL(13,4)'} 'sum': {type: 'DECIMAL(13,4)'}
'fee': {type: 'DECIMAL(13,4)'} 'fee': {type: 'DECIMAL(13,4)'}
'event_id': {source: 'eid'} 'event_id': {source: 'eid'}