What happens when your data model changes?
This isn't a problem for tutorial.happstack.com, because typically there are only a few dozen users and jobs, plus whatever dummy data I've entered myself. Who cares? So far, rather than migrating, I've just wiped the slate clean.
However, that isn't going to work for your latest facebook-killer. Instead, you need to use Happstack's migration machinery. Migrating is actually far simpler than one might expect. There are really only two things you need to understand to make it work: the Migrate and Version type classes.
ghci>:m + Happstack.Data
ghci>:i Migrate
class Migrate a b where migrate :: a -> b
-- Defined in Happstack.Data.Migrate
ghci>:i Version
class Version a where mode :: Mode a
-- Defined in Happstack.Data.Serialize
ghci>:i Mode
data Mode a
= Primitive | Versioned (Happstack.Data.Serialize.VersionId a) (Maybe (Happstack.Data.Serialize.Previous a))
-- Defined in Happstack.Data
Now, you've already seen in previous Happstack.State examples that we've been relying on the default instance of Version. It defines the given type as being of version number 0 and having no previous version. This is good enough for your first version of application state.
The basic intuition is that if you want one data type to be converted to another in a new version, it needs to be reflected in an instance of Migrate, with the actual conversion function between the two types, and in the Version instance of the new state type. You really don't need to do a lot more than this in order to have your migration working correctly.
Try taking a look at the code in src/migrationexample in order to get a feel for how to practically make migrations work.