make migration rerunnable
This commit is contained in:
parent
a8f6c6d6dd
commit
67c6dd475f
1 changed files with 5 additions and 1 deletions
|
@ -3,6 +3,7 @@ import Database.HDBC.PostgreSQL
|
||||||
import System.IO
|
import System.IO
|
||||||
import System.Directory
|
import System.Directory
|
||||||
import Control.Exception
|
import Control.Exception
|
||||||
|
import Control.Monad (when)
|
||||||
import Data.Maybe (fromJust)
|
import Data.Maybe (fromJust)
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import qualified Data.ByteString.Char8 as B
|
import qualified Data.ByteString.Char8 as B
|
||||||
|
@ -78,7 +79,10 @@ main = do
|
||||||
pPix = scale (pWidth, pHeight) orig
|
pPix = scale (pWidth, pHeight) orig
|
||||||
savePngImage tPath $ ImageRGBA8 tPix
|
savePngImage tPath $ ImageRGBA8 tPix
|
||||||
savePngImage pPath $ ImageRGBA8 pPix
|
savePngImage pPath $ ImageRGBA8 pPix
|
||||||
mapM (removeFile . (FP.</>) pathPrefix) [oldThumbName, oldPrevName]
|
mapM (\x -> do
|
||||||
|
let fullpath = pathPrefix FP.</> x
|
||||||
|
dfe <- doesFileExist fullpath
|
||||||
|
when dfe (removeFile fullpath)) [oldThumbName, oldPrevName]
|
||||||
return [SqlByteString (B.pack $ '/':tPath), SqlByteString (B.pack $ '/':pPath), theId]
|
return [SqlByteString (B.pack $ '/':tPath), SqlByteString (B.pack $ '/':pPath), theId]
|
||||||
_ ->
|
_ ->
|
||||||
error "malformed entry"
|
error "malformed entry"
|
||||||
|
|
Loading…
Reference in a new issue