getting foreign key data with a column.

This commit is contained in:
Adam C. Baker
2014-10-08 15:20:26 -07:00
parent 59f9855362
commit f0e8d23dd2
2 changed files with 16 additions and 10 deletions
+7 -1
View File
@@ -16,12 +16,18 @@ spec = around dbWithSchema $ beforeWith setRole $ do
map tableName ts `shouldBe` ["auto_incrementing_pk","compound_pk",
"has_fk","items","menagerie","no_pk", "simple_pk"]
describe "columns" $
describe "columns" $ do
it "responds with each column for the table" $ \conn -> do
cs <- columns "1" "auto_incrementing_pk" conn
map colName cs `shouldBe` ["id","nullable_string","non_nullable_string",
"inserted_at"]
it "includes foreign key data" $ \conn -> do
cs <- columns "1" "has_fk" conn
map colFK cs `shouldBe` [Nothing,
Just $ ForeignKey "auto_incrementing_pk" "id",
Just $ ForeignKey "simple_pk" "k"]
describe "foreignKeys" $
it "has a description of the foreign key columns" $ \conn ->
foreignKeys "1" "has_fk" conn `shouldReturn` M.fromList [