Copyright | Flipstone Technology Partners 2023 |
---|---|
License | MIT |
Stability | Stable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Since: 1.0.0.0
Synopsis
- data IndexDefinition
- indexCreationStrategy :: IndexDefinition -> IndexCreationStrategy
- setIndexCreationStrategy :: IndexCreationStrategy -> IndexDefinition -> IndexDefinition
- uniqueIndex :: NonEmpty FieldName -> IndexDefinition
- uniqueNamedIndex :: String -> IndexBodyExpr -> IndexDefinition
- nonUniqueIndex :: NonEmpty FieldName -> IndexDefinition
- nonUniqueNamedIndex :: String -> IndexBodyExpr -> IndexDefinition
- mkIndexDefinition :: IndexUniqueness -> NonEmpty FieldName -> IndexDefinition
- mkNamedIndexDefinition :: IndexUniqueness -> String -> IndexBodyExpr -> IndexDefinition
- data IndexUniqueness
- indexCreateExpr :: IndexDefinition -> Qualified TableName -> CreateIndexExpr
- data IndexCreationStrategy
Documentation
data IndexDefinition Source #
Defines an index that can be added to a TableDefinition
.
Use one of the constructor functions below (such as uniqueIndex
) to
construct the index definition you wish to have and then use
addTableIndexes
to add them to your table definition.
Orville will then add the index next time you run auto-migrations.
Since: 1.0.0.0
indexCreationStrategy :: IndexDefinition -> IndexCreationStrategy Source #
Gets the IndexCreationStrategy
to be used when creating the index described
by the IndexDefinition
. By default, all indexes are created using the
Transactional
strategy.
Since: 1.0.0.0
setIndexCreationStrategy :: IndexCreationStrategy -> IndexDefinition -> IndexDefinition Source #
Sets the IndexCreationStrategy
to be used when creating the index described
by the IndexDefinition
. By default, all indexes are created using the
Transactional
strategy, but some tables are too large for this to be
feasible. See the Concurrent
creation strategy for how to work around this.
Since: 1.0.0.0
uniqueIndex :: NonEmpty FieldName -> IndexDefinition Source #
Constructs an IndexDefinition
for a UNIQUE
index on the given columns.
Since: 1.0.0.0
uniqueNamedIndex :: String -> IndexBodyExpr -> IndexDefinition Source #
Constructs an IndexDefinition
for a UNIQUE
index with given SQL and index
name.
Since: 1.0.0.0
nonUniqueIndex :: NonEmpty FieldName -> IndexDefinition Source #
Constructs an IndexDefinition
for a non-unique index on the given columns.
Since: 1.0.0.0
nonUniqueNamedIndex :: String -> IndexBodyExpr -> IndexDefinition Source #
Constructs an IndexDefinition
for a non-unique index with given SQL and
index name.
Since: 1.0.0.0
mkIndexDefinition :: IndexUniqueness -> NonEmpty FieldName -> IndexDefinition Source #
Constructs an IndexDefinition
for an index on the given columns with the
given uniqueness.
Since: 1.0.0.0
mkNamedIndexDefinition :: IndexUniqueness -> String -> IndexBodyExpr -> IndexDefinition Source #
Constructs an IndexDefinition
for an index with the given uniqueness, given
name, and given SQL.
Since: 1.0.0.0
data IndexUniqueness Source #
Type to represent if an index should be unique.
Since: 1.0.0.0
Instances
Show IndexUniqueness Source # | Since: 1.0.0.0 |
Defined in Orville.PostgreSQL.Expr.Index showsPrec :: Int -> IndexUniqueness -> ShowS # show :: IndexUniqueness -> String # showList :: [IndexUniqueness] -> ShowS # | |
Eq IndexUniqueness Source # | Since: 1.0.0.0 |
Defined in Orville.PostgreSQL.Expr.Index (==) :: IndexUniqueness -> IndexUniqueness -> Bool # (/=) :: IndexUniqueness -> IndexUniqueness -> Bool # | |
Ord IndexUniqueness Source # | Since: 1.0.0.0 |
Defined in Orville.PostgreSQL.Expr.Index compare :: IndexUniqueness -> IndexUniqueness -> Ordering # (<) :: IndexUniqueness -> IndexUniqueness -> Bool # (<=) :: IndexUniqueness -> IndexUniqueness -> Bool # (>) :: IndexUniqueness -> IndexUniqueness -> Bool # (>=) :: IndexUniqueness -> IndexUniqueness -> Bool # max :: IndexUniqueness -> IndexUniqueness -> IndexUniqueness # min :: IndexUniqueness -> IndexUniqueness -> IndexUniqueness # |
indexCreateExpr :: IndexDefinition -> Qualified TableName -> CreateIndexExpr Source #
Gets the SQL expression that will be used to add the index to the specified table.
Since: 1.0.0.0
data IndexCreationStrategy Source #
Defines how an IndexDefinition
will be executed to add an index to a table.
By default, all indexes are created using the Transactional
strategy.
Since: 1.0.0.0
Transactional | The default strategy. The index will be added as part of a database transaction along with all the other DDL being executed to migrate the database schema. If any migration should fail, the index creation will be rolled back as part of the transaction. This is how schema migrations work in general in Orville. |
Concurrent | Creates the index using the |
Instances
Show IndexCreationStrategy Source # | |
Defined in Orville.PostgreSQL.Internal.IndexDefinition showsPrec :: Int -> IndexCreationStrategy -> ShowS # show :: IndexCreationStrategy -> String # showList :: [IndexCreationStrategy] -> ShowS # | |
Eq IndexCreationStrategy Source # | |
Defined in Orville.PostgreSQL.Internal.IndexDefinition (==) :: IndexCreationStrategy -> IndexCreationStrategy -> Bool # (/=) :: IndexCreationStrategy -> IndexCreationStrategy -> Bool # |