persistent 2.13.0.3 → 2.13.0.4
raw patch · 4 files changed
+23/−11 lines, 4 files
Files
- ChangeLog.md +7/−0
- Database/Persist/Sql/Migration.hs +11/−9
- Database/Persist/Sql/Types.hs +4/−1
- persistent.cabal +1/−1
ChangeLog.md view
@@ -1,5 +1,11 @@ # Changelog for persistent +## 2.13.0.4++* [#1277](https://github.com/yesodweb/persistent/pull/1277)+ * Corrected the documentation of `addMigration` to match the actual+ behaviour - this will not change the behaviour of your code.+ ## 2.13.0.3 * [#1287](https://github.com/yesodweb/persistent/pull/1287)@@ -7,6 +13,7 @@ * Fixes an issue where generating code would refer to the `ModelName` when making a reference to another table when the explicit code only refers to `ModelNameId`.+ ## 2.13.0.2
Database/Persist/Sql/Migration.hs view
@@ -22,20 +22,20 @@ import Control.Exception (throwIO) import Control.Monad (liftM, unless) import Control.Monad.IO.Unlift-import Control.Monad.Trans.Class (MonadTrans (..))-import Control.Monad.Trans.Reader (ReaderT (..), ask)+import Control.Monad.Trans.Class (MonadTrans(..))+import Control.Monad.Trans.Reader (ReaderT(..), ask) import Control.Monad.Trans.Writer-import Data.Text (Text, unpack, snoc, isPrefixOf, pack)+import Data.Text (Text, isPrefixOf, pack, snoc, unpack) import qualified Data.Text.IO+import GHC.Stack import System.IO import System.IO.Silently (hSilence)-import GHC.Stack +import Database.Persist.Sql.Orphan.PersistStore ()+import Database.Persist.Sql.Raw import Database.Persist.Sql.Types import Database.Persist.Sql.Types.Internal-import Database.Persist.Sql.Raw import Database.Persist.Types-import Database.Persist.Sql.Orphan.PersistStore() allSql :: CautiousMigration -> [Sql] allSql = map snd@@ -195,12 +195,14 @@ -- @since 2.9.2 addMigration :: Bool- -- ^ Is the migration safe to run? (eg a non-destructive and idempotent- -- update on the schema)+ -- ^ Is the migration unsafe to run? (eg a destructive or non-idempotent+ -- update on the schema). If 'True', the migration is *unsafe*, and will+ -- need to be run manually later. If 'False', the migration is *safe*, and+ -- can be run any number of times. -> Sql -- ^ A 'Text' value representing the command to run on the database. -> Migration-addMigration isSafe sql = lift (tell [(isSafe, sql)])+addMigration isUnsafe sql = lift (tell [(isUnsafe, sql)]) -- | Add a 'CautiousMigration' (aka a @[('Bool', 'Text')]@) to the -- migration plan.
Database/Persist/Sql/Types.hs view
@@ -63,7 +63,10 @@ type Sql = Text --- Bool indicates if the Sql is safe+-- | A list of SQL operations, marked with a safety flag. If the 'Bool' is+-- 'True', then the operation is *unsafe* - it might be destructive, or+-- otherwise not idempotent. If the 'Bool' is 'False', then the operation+-- is *safe*, and can be run repeatedly without issues. type CautiousMigration = [(Bool, Sql)] -- | A 'Migration' is a four level monad stack consisting of:
persistent.cabal view
@@ -1,5 +1,5 @@ name: persistent-version: 2.13.0.3+version: 2.13.0.4 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>