sqlExport: Fix missing transactions by making whole row unique
This is probably not a good way to fix this, but it does work. Fixes #2
This commit is contained in:
parent
ae0cf430b5
commit
74827ac9ad
@ -72,7 +72,9 @@ try:
|
|||||||
|
|
||||||
c.execute("CREATE TABLE IF NOT EXISTS transactions (" +
|
c.execute("CREATE TABLE IF NOT EXISTS transactions (" +
|
||||||
createDefinitionsFromTableMap(tableMapping['transactions']) +
|
createDefinitionsFromTableMap(tableMapping['transactions']) +
|
||||||
", CONSTRAINT `fk_member_uid` FOREIGN KEY (uid) REFERENCES members(uid));")
|
", UNIQUE (" +
|
||||||
|
','.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 (
|
||||||
|
@ -78,9 +78,8 @@ members:
|
|||||||
transactions:
|
transactions:
|
||||||
'sid': {type: CHAR(27)}
|
'sid': {type: CHAR(27)}
|
||||||
'uid': {type: CHAR(24)}
|
'uid': {type: CHAR(24)}
|
||||||
# TODO: this is a terrible PK
|
'timestamp': {type: 'INT(11)', source: '_dp'} # TODO: should be a real timestamp?
|
||||||
'timestamp': {type: 'INT(11) PRIMARY KEY', source: '_dp'} # TODO: should be a real timestamp?
|
'type': {type: 'VARCHAR(24)', source: 'Transaction Type'}
|
||||||
'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'}
|
||||||
|
Reference in New Issue
Block a user