Function

Seagullmigrations_run_from_resources

since: 0.1

Declaration [src]

gboolean
seagull_migrations_run_from_resources (
  SeagullSqlite3* 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: 0.1

Parameters

db

Type: SeagullSqlite3

The sqlite3 connection.

The data is owned by the caller of the function.
path

Type: const char*

The base path of the resource to use.

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

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.
error

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 be 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; otherwise false with error potentially set.