         }
     }
     
-    static func revertProblemCase(_ database: Database) throws {
-        try database.delete(ProblemCase.self)
+    static func revert(_ database: Database) throws {
+        try database.delete(self)
     }
     
+}
+
+extension ResultCase: Preparation {
     
-    static func prepareResultCase(_ database: Database) throws {
-        try database.create(ResultCase.self) { builder in
+    static func prepare(_ database: Database) throws {
+        try database.create(self) { builder in
+            
             builder.id()
             builder.parent(Submission.self, optional: false)
             builder.parent(ProblemCase.self, optional: false)

final class P20170910: Preparation {
    
    static func prepare(_ database: Database) throws {
        try prepareUser(database)
        try prepareProblem(database)
        try prepareProblemCase(database)
        try prepareEvent(database)
        try prepareEventProblem(database)
        try prepareSubmission(database)
        try prepareResultCase(database)
    }
    
    static func revert(_ database: Database) throws {
        try revertResultCase(database)
        try revertSubmission(database)
        try revertEventProblem(database)
        try revertEvent(database)
        try revertProblemCase(database)
        try revertProblem(database)
        try revertUser(database)
    }
    
    static func prepareEvent(_ database: Database) throws {
        try database.create(Event.self) { builder in
            builder.id()
            builder.string("name")
            builder.parent(User.self, optional: false)

        }
    }
    
    static func revert(_ database: Database) throws {
        try database.delete(self)
    }
    
}

extension User: Preparation {
    
    static func prepare(_ database: Database) throws {
        try database.create(self) { builder in
            builder.id()
            builder.string("name")
            builder.string("username")
