Function

Purplesqlite3_run_migrations_from_resources

Declaration [src]

gboolean
purple_sqlite3_run_migrations_from_resources (
  PurpleSqlite3* db,
  const char* path,
  const char** migrations,
  GError** error
)

Description [src]

Runs the given migrations in the order they are given. The index of each migration plus 1 is assumed to be the version number of the migration, which means that you can not change the order of the migrations. The reasoning for the addition of 1 is because PRAGMA user_version defaults to 0.

This will attempt to load the migrations via g_resources_open_stream() by concatenating path and the individual items of migrations. Each migration will be ran in a transaction that includes updating the schema version, which is stored in PRAGMA user_version. This means you can’t use PRAGMA user_version for other things.

Available since:3.0.0

Parameters

db PurpleSqlite3
 

The sqlite3 connection.

 The data is owned by the caller of the function.
path const char*
 

The base path in resource to use.

 The data is owned by the caller of the function.
 The value is a NUL terminated UTF-8 string.
migrations An array of char*
 

The list of migrations in the order to run them.

 The array must be NULL-terminated.
 The data is owned by the caller of the function.
 Each element is a NUL terminated UTF-8 string.
error GError **
  The return location for a GError*, or NULL.

Return value

Returns: gboolean
 

TRUE on success, or FALSE on error potentially with error set.