Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
On creating new migrations, denote apply/revert blocks as YAML ASCII …
Browse files Browse the repository at this point in the history
…literals by default
  • Loading branch information
jtdaugherty committed Feb 6, 2015
1 parent 9f0db68 commit 9692cc9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Database/Schema/Migrations/Filesystem/Serialize.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ serializeRevert :: FieldSerializer
serializeRevert m =
case mRevert m of
Nothing -> Nothing
Just revert -> Just $ "Revert:\n" ++
Just revert -> Just $ "Revert: |\n" ++
(serializeMultiline revert)

serializeApply :: FieldSerializer
serializeApply m = Just $ "Apply:\n" ++ (serializeMultiline $ mApply m)
serializeApply m = Just $ "Apply: |\n" ++ (serializeMultiline $ mApply m)

commonPrefix :: String -> String -> String
commonPrefix a b = map fst $ takeWhile (uncurry (==)) (zip a b)
Expand Down
14 changes: 7 additions & 7 deletions test/FilesystemSerializeTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,36 +35,36 @@ serializationTestCases :: [(Migration, String)]
serializationTestCases = [ (valid_full, "Description: A valid full migration.\n\
\Created: " ++ tsStr ++ "\n\
\Depends: another_migration\n\
\Apply:\n\
\Apply: |\n\
\ CREATE TABLE test (\n\
\ a int\n\
\ );\n\n\
\Revert:\n\
\Revert: |\n\
\ DROP TABLE test;\n")
, (valid_full { mDesc = Nothing }
, "Created: " ++ tsStr ++ "\n\
\Depends: another_migration\n\
\Apply:\n\
\Apply: |\n\
\ CREATE TABLE test (\n\
\ a int\n\
\ );\n\n\
\Revert:\n\
\Revert: |\n\
\ DROP TABLE test;\n")
, (valid_full { mDeps = ["one", "two"] }
, "Description: A valid full migration.\n\
\Created: " ++ tsStr ++ "\n\
\Depends: one two\n\
\Apply:\n\
\Apply: |\n\
\ CREATE TABLE test (\n\
\ a int\n\
\ );\n\n\
\Revert:\n\
\Revert: |\n\
\ DROP TABLE test;\n")
, (valid_full { mRevert = Nothing }
, "Description: A valid full migration.\n\
\Created: " ++ tsStr ++ "\n\
\Depends: another_migration\n\
\Apply:\n\
\Apply: |\n\
\ CREATE TABLE test (\n\
\ a int\n\
\ );\n")
Expand Down

0 comments on commit 9692cc9

Please sign in to comment.