NAME

File::FStore::Migration - Module for interacting with file stores

VERSION

version v0.04

SYNOPSIS

use File::FStore;

my File::FStore::Migration $migration = $store->migration;

This package provides simple migration utilities.

This package inherits from File::FStore::Base. However "contentise" in File::FStore::Base is not supported by this package. Calling that method will die.

METHODS

upgrade

$migration->upgrade;

Upgrade database to current schema.

new_adder

my File::FStore::Adder $adder = $migration->new_adder;

Proxy for "new_adder" in File::FStore.

import_data

$migration->import_data(...);

Proxy for "import_data" in File::FStore.

export_data

$migration->export_data(...);

Proxy for "export" in File::FStore.

insert_directory

$migration->insert_directory($path, %opts);

Inserts the files in the given directory into the store.

$path is the path of the directory (in OS specific format).

The following options (all optional) are supported:

basename_filter

A regex used to filter files before insert by basename. See "qr" in perlop.

Note: This filter applies to files and sub-directories alike. It matches the OS specific basename format.

in_mode

The mode to use. link_in (the default) or move_in. See "link_in" in File::FStore::Adder and "move_in" in File::FStore::Adder.

Note: While move_in can be more easy to use and slightly more portable, it comes at a higher risk of loosing files if the insert fails.

on_error

A function to call on insert errors. The first argument is undefined. The following arguments are a hash.

The key path holds the path to the file to be inserted (in OS specific format). The key basename holds the basename of the file (in OS specific format).

The error can be found in $@.

on_post_insert

A function to be called after the insert. The first argument is the newly created File::FStore::File. The rest is a hash as per on_error.

on_pre_insert

A function to be called before the insert. The first argument is the used File::FStore::Adder. The rest is a hash as per on_error.

insert_tagpool

$migration->insert_tagpool($path, %opts);

Inserts the content of a tagpool into the store.

$path is the same path to the pool (in OS specific format).

This method accepts all options of "insert_directory" but basename_filter.

Note: For best performace the object returned by "fii" in File::FStore::Base should be aware of the pool.

AUTHOR

Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2025 by Löwenfelsen UG (haftungsbeschränkt) <support@loewenfelsen.net>.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)