since: 3.0

Declaration [src]

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



Type: PurpleSqlite3

The sqlite3 connection.

The data is owned by the caller of the function.

Type: 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.

Type: 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.

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will left initialized to NULL by the function if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: gboolean

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