taler-docs

Documentation for GNU Taler components, APIs and protocols
Log | Files | Refs | README | LICENSE

taler-merchant-dbinit.1.rst (4353B)


      1 taler-merchant-dbinit(1)
      2 ########################
      3 
      4 .. only:: html
      5 
      6    Name
      7    ====
      8 
      9    **taler-merchant-dbinit** - initialize Taler merchant database
     10 
     11 
     12 Synopsis
     13 ========
     14 
     15 **taler-merchant-dbinit**
     16 [**--dry**]
     17 [**-c** *FILENAME* | **--config=**\ ‌\ *FILENAME*]
     18 [**-g** | **--gc**]
     19 [**-h** | **--help**]
     20 [**-L** *LOGLEVEL* | **--loglevel=**\ ‌\ *LOGLEVEL*]
     21 [**-l** *FILENAME* | **--logfile=**\ ‌\ *FILENAME*]
     22 [**-r** | **--reset**]
     23 [**-v** | **--version**]
     24 
     25 Description
     26 ===========
     27 
     28 **taler-merchant-dbinit** is a command-line tool to initialize the Taler
     29 merchant database. By default it applies schema patches and installs stored
     30 procedures. Stop all Merchant services and back up the database before upgrading.
     31 For the standard local Debian setup, **taler-merchant-dbconfig** invokes this
     32 command with the package configuration and database identity.
     33 
     34 Normal initialization skips stored-procedure files whose recorded contents
     35 are current. Schema upgrades also refresh procedures. Databases initialized
     36 before content tracking was introduced require one procedure refresh.
     37 
     38 Normal initialization always executes ``versioning.sql`` under the migration
     39 lock. This script upgrades the shared ``_v`` metadata schema transactionally
     40 and records its revision in ``_v.versioning``. An already-current script
     41 leaves schema objects and metadata unchanged. A script with an older target
     42 revision preserves a newer installed revision.
     43 
     44 If an upgrade fails, rerun
     45 **taler-merchant-dbinit** to complete it before restarting the services.
     46 Services refuse to start while the final upgrade steps are unfinished.
     47 
     48 Its options are as follows:
     49 
     50 **--dry**
     51    Inspect pending initialization and upgrade work without modifying the
     52    database. Output contains one tab-separated line per action: kind,
     53    component, SQL filename or finalization statement, and reason. A current
     54    database produces no output. Diagnostics go to standard error.
     55 
     56    Inspection includes versioning-schema upgrades, numbered migrations,
     57    stored-procedure updates, and synchronization of procedures into merchant
     58    instance schemas.
     59 
     60    This option has no short form. It cannot be combined with reset or
     61    maintenance actions.
     62 
     63    Exit status is 0 when current, 2 when work is pending, and 1 on inspection
     64    failure. An existing empty database can be inspected; a missing database
     65    or failed connection is an error. The plan describes a snapshot and does
     66    not guarantee that executing the SQL will succeed.
     67 
     68    Dry inspection compares the target revision declared in ``versioning.sql``
     69    with ``_v.versioning`` without executing the script. A missing revision table
     70    is treated as revision zero, including on existing databases. The script also
     71    creates the stored-procedure hash registry when upgrading a legacy database.
     72 
     73    Content hashes track files applied by these tools. They do not detect
     74    manual edits to database procedures or changes made by older tools.
     75 
     76 **-c** *FILENAME* \| **--config=**\ ‌\ *FILENAME*
     77    Use the configuration and other resources for the merchant to operate
     78    from *FILENAME*.
     79 
     80 **-g** \| **--gc**
     81    Garbage collect expired data without initializing or migrating the schema
     82    or replacing stored procedures. Requires a current schema; exits with status
     83    1 if the schema check or garbage collection fails.
     84 
     85 **-h** \| **--help**
     86    Print short help on options.
     87 
     88 **-L** *LOGLEVEL* \| **--loglevel=**\ ‌\ *LOGLEVEL*
     89    Specifies the log level to use. Accepted values are: ``DEBUG``, ``INFO``,
     90    ``WARNING``, ``ERROR``.
     91 
     92 **-l** *FILENAME* \| **--logfile=**\ ‌\ *FILENAME*
     93    Send logging output to *FILENAME*.
     94 
     95 **-r** \| **--reset**
     96    Drop tables. Dangerous, will delete all existing data in the database
     97    before creating the tables. Takes precedence over **-g** if both are given.
     98 
     99 **-v** \| **–version**
    100    Print version information.
    101 
    102 Exit Status
    103 ===========
    104 
    105 ``0``
    106    The requested database operation completed successfully.
    107 
    108 ``1``
    109    A database connection or operation failed.
    110 
    111 ``2``
    112    Dry inspection found pending initialization or upgrade work.
    113 
    114 ``3``
    115    Command-line or configuration processing failed.
    116 
    117 See Also
    118 ========
    119 
    120 taler-merchant-httpd(1), taler-merchant-dbconfig(1), taler-merchant.conf(5).
    121 
    122 Bugs
    123 ====
    124 
    125 Report bugs by using https://bugs.taler.net or by sending electronic
    126 mail to <taler@gnu.org>.