from sqlalchemy import Column, Integer, String, Text, ForeignKey

from . import Base

class SubmittedFile(Base):
	__tablename__ = 'submitted_files'
	__table_args__ = (
		{
			'mysql_engine': 'InnoDB',
			'mysql_charset': 'utf8',
		})

	id = Column(Integer, primary_key=True)
	evaluation = Column(Integer, ForeignKey('evaluations.id'), nullable=False)
	mime = Column(String(255))
	path = Column(String(255), nullable=False)

class SubmittedCode(Base):
	__tablename__ = 'submitted_codes'
	__table_args__ = (
		{
			'mysql_engine': 'InnoDB',
			'mysql_charset': 'utf8',
		})

	evaluation = Column(Integer, ForeignKey('evaluations.id'), primary_key=True, nullable=False)
	code = Column(Text, nullable=False)

@@ -566,16 +566,56 @@
 ,%0A%09%09%7D)%0A%0A
+%09id = Column(Integer, primary_key=True)%0A
 %09evaluat
@@ -669,26 +669,8 @@
 d'),
- primary_key=True,
  nul

Fix submitted_codes db (add id as primary index)