cigogne/types
Types
cigogne’s general configuration
pub type Config {
Config(
connection: ConnectionConfig,
database_schema_to_use: String,
migration_table_name: String,
schema_config: SchemaConfig,
migration_folder: String,
migration_file_pattern: String,
)
}
Constructors
-
Config( connection: ConnectionConfig, database_schema_to_use: String, migration_table_name: String, schema_config: SchemaConfig, migration_folder: String, migration_file_pattern: String, )
The configuration linked to the database connection
pub type ConnectionConfig {
EnvVarConfig
UrlConfig(url: String)
PogConfig(config: pog.Config)
ConnectionConfig(connection: pog.Connection)
}
Constructors
-
EnvVarConfigThe default configuration. It uses the DATABASE_URL envvar to connect
-
UrlConfig(url: String)A configuration using the URL to the database
-
PogConfig(config: pog.Config)A configuration using a pog.Config to connect. It disables schema generation.
-
ConnectionConfig(connection: pog.Connection)A configuration using a pog.Connection directly. It disables schema generation.
The errors returned by cigogne
pub type MigrateError {
EnvVarError(name: String)
UrlError(url: String)
FileError(path: String)
CreateFolderError(path: String)
PatternError(error: String)
FileNameError(path: String)
CompoundError(errors: List(MigrateError))
ContentError(path: String, error: String)
PGOTransactionError(error: pog.TransactionError(String))
PGOQueryError(error: pog.QueryError)
NoResultError
SchemaQueryError(error: String)
NoMigrationToApplyError
NoMigrationToRollbackError
MigrationNotFoundError(
timestamp: timestamp.Timestamp,
name: String,
)
DateParseError(date: String)
FileHashChanged(
migration_ts: timestamp.Timestamp,
migration_name: String,
)
NameTooLongError(name: String)
ActorStartError(error: actor.StartError)
}
Constructors
-
EnvVarError(name: String) -
UrlError(url: String) -
FileError(path: String) -
CreateFolderError(path: String) -
PatternError(error: String) -
FileNameError(path: String) -
CompoundError(errors: List(MigrateError)) -
ContentError(path: String, error: String) -
PGOTransactionError(error: pog.TransactionError(String)) -
PGOQueryError(error: pog.QueryError) -
NoResultError -
SchemaQueryError(error: String) -
NoMigrationToApplyError -
NoMigrationToRollbackError -
MigrationNotFoundError( timestamp: timestamp.Timestamp, name: String, ) -
DateParseError(date: String) -
FileHashChanged( migration_ts: timestamp.Timestamp, migration_name: String, ) -
NameTooLongError(name: String) -
ActorStartError(error: actor.StartError)
Migrations are often generated by reading migration files. However, we allow you to create your own Migrations
pub type Migration {
Migration(
path: String,
timestamp: timestamp.Timestamp,
name: String,
queries_up: List(String),
queries_down: List(String),
sha256: String,
)
}
Constructors
-
Migration( path: String, timestamp: timestamp.Timestamp, name: String, queries_up: List(String), queries_down: List(String), sha256: String, )
The configuration related to schema file generation
pub type SchemaConfig {
SchemaConfig(generate: Bool, filename: String)
}
Constructors
-
SchemaConfig(generate: Bool, filename: String)
Values
pub fn print_migrate_error(error: MigrateError) -> Nil
Print a MigrateError to the stderr