diff --git a/sqlExport.py b/sqlExport.py index 82c74ff..9f294fb 100644 --- a/sqlExport.py +++ b/sqlExport.py @@ -72,9 +72,7 @@ try: c.execute("CREATE TABLE IF NOT EXISTS transactions (" + createDefinitionsFromTableMap(tableMapping['transactions']) + - ", UNIQUE (" + - ','.join(f'`{k}`' for k in tableMapping['transactions'].keys()) + - "), FOREIGN KEY (uid) REFERENCES members(uid));") + ", CONSTRAINT `fk_member_uid` FOREIGN KEY (uid) REFERENCES members(uid));") #-- FOREIGN KEY event_id REFERENCES event eid c.execute("""CREATE TABLE IF NOT EXISTS labels ( diff --git a/tableMapping.yaml b/tableMapping.yaml index 8e26562..0ad28c9 100644 --- a/tableMapping.yaml +++ b/tableMapping.yaml @@ -78,8 +78,9 @@ members: transactions: 'sid': {type: CHAR(27)} 'uid': {type: CHAR(24)} - 'timestamp': {type: 'INT(11)', source: '_dp'} # TODO: should be a real timestamp? - 'type': {type: 'VARCHAR(24)', source: 'Transaction Type'} + # TODO: this is a terrible PK + 'timestamp': {type: 'INT(11) PRIMARY KEY', source: '_dp'} # TODO: should be a real timestamp? + 'type': {source: 'Transaction Type'} 'sum': {type: 'DECIMAL(13,4)'} 'fee': {type: 'DECIMAL(13,4)'} 'event_id': {source: 'eid'}