Search code examples
haskellhaskelldb

How do I specify a primary key on table creation with haskellDB?


Currently I am using something like this:

dbCreateTable db "MyTable" [ ("Col1", (StringT, False)), ("Col2", (StringT, False)) ]

which works fine, but i'd like to make "Col1" the primary key. Do i need to go back to raw SQL?

edit: This still seems to hold: "The part of creating a database from Haskell itself is not very useful, for example you cannot express foreign- and primary keys, indexes and constraints. Even the most simple database will need one of these."

From http://www.mijnadres.net/published/HaskellDB.pdf


Solution

  • As the edit notes, HaskellDB is not very good at creating tables at the moment. It's best to build a database first, and then extract the info.