migrations :: MonadSql m => Int64 -> Transaction m [EntityDef]
migrations = Utils.mkMigrationLookup
    [ 0 .= V0.schema
    , 26 .> schema $ do
        Utils.executeSql [i|
ALTER TABLE "Implementation" ADD COLUMN "timestamp" TIMESTAMP
|]

        Utils.executeSql [i|
REPLACE INTO "Implementation"
SELECT Implementation.id
     , Implementation.algorithmId
     , Implementation.name
     , Implementation.prettyName
     , Implementation.flags
     , Implementation.type
     , IFNULL(TimeStamp.minTime, strftime('%Y-%m-%dT%H:%M:%f', 'now'))
FROM Implementation
LEFT JOIN
(   SELECT Run.implId, MIN(Run.timestamp) AS minTime
    FROM Run
    GROUP BY Run.implId
) AS TimeStamp
ON Implementation.id = TimeStamp.implId
|]
    ]
migrations :: MonadSql m => Int64 -> Transaction m [EntityDef]
migrations = Utils.mkMigrationLookup
    [ 0 .= V0.schema
    , 26 .> schema $ do
        Utils.executeSql [i|
ALTER TABLE "Implementation" ADD COLUMN "timestamp" TIMESTAMP
|]

        Utils.executeSql [i|
REPLACE INTO "Implementation"
SELECT Implementation.id
     , Implementation.algorithmId
     , Implementation.name
     , Implementation.prettyName
     , Implementation.flags
     , Implementation.type
     , IFNULL(TimeStamp.minTime, strftime('%Y-%m-%dT%H:%M:%f', 'now'))
FROM Implementation
LEFT JOIN
(   SELECT Run.implId, MIN(Run.timestamp) AS minTime
    FROM Run
    GROUP BY Run.implId
) AS TimeStamp
ON Implementation.id = TimeStamp.implId
|]
    ]
migrations = Utils.mkMigrationLookup
    [ 0 .= V0.schema
    , 26 .> schema $ do
        Utils.executeSql [i|
ALTER TABLE "Implementation" ADD COLUMN "timestamp" TIMESTAMP
|]

        Utils.executeSql [i|
REPLACE INTO "Implementation"
SELECT Implementation.id
     , Implementation.algorithmId
     , Implementation.name
     , Implementation.prettyName
     , Implementation.flags
     , Implementation.type
     , IFNULL(TimeStamp.minTime, strftime('%Y-%m-%dT%H:%M:%f', 'now'))
FROM Implementation
LEFT JOIN
(   SELECT Run.implId, MIN(Run.timestamp) AS minTime
    FROM Run
    GROUP BY Run.implId
) AS TimeStamp
ON Implementation.id = TimeStamp.implId
|]
    ]