37 lines
960 B
Haskell
37 lines
960 B
Haskell
|
{-# LANGUAGE EmptyDataDecls #-}
|
||
|
{-# LANGUAGE FlexibleContexts #-}
|
||
|
{-# LANGUAGE GADTs #-}
|
||
|
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
||
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
||
|
{-# LANGUAGE OverloadedStrings #-}
|
||
|
{-# LANGUAGE QuasiQuotes #-}
|
||
|
{-# LANGUAGE TemplateHaskell #-}
|
||
|
{-# LANGUAGE TypeFamilies #-}
|
||
|
{-# LANGUAGE DeriveGeneric #-}
|
||
|
{-# LANGUAGE FlexibleInstances #-}
|
||
|
|
||
|
module Model where
|
||
|
|
||
|
import GHC.Generics
|
||
|
import Database.Persist
|
||
|
import Database.Persist.Sql
|
||
|
import Database.Persist.TH
|
||
|
|
||
|
import PasteType
|
||
|
|
||
|
share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase|
|
||
|
User json
|
||
|
username String
|
||
|
Username username
|
||
|
deriving Show Generic
|
||
|
|
||
|
Paste json
|
||
|
parent UserId
|
||
|
name String
|
||
|
content String
|
||
|
type PasteType
|
||
|
deriving Show Generic
|
||
|
|]
|
||
|
|
||
|
doMigrations :: SqlPersistT IO ()
|
||
|
doMigrations = runMigration migrateAll
|