Peace/doc/lib/Peace/DB.pm.html

73 lines
1.8 KiB
HTML

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Peace::DB - Database handler generator for the Peace shop.</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:Alpine@build-edge-aarch64.nonet" />
</head>
<body>
<ul id="index">
<li><a href="#NAME">NAME</a></li>
<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
<li><a href="#FUNCTIONS">FUNCTIONS</a>
<ul>
<li><a href="#dbh">dbh</a></li>
<li><a href="#run_migrations">run_migrations</a></li>
</ul>
</li>
<li><a href="#SEE-ALSO">SEE ALSO</a></li>
</ul>
<h1 id="NAME">NAME</h1>
<p>Peace::DB - Database handler generator for the Peace shop.</p>
<h1 id="SYNOPSIS">SYNOPSIS</h1>
<pre><code>my $peace = Peace-&gt;new;
my $home = $ENV{HOME};
my $config =
$peace-&gt;plugin(
JSONConfig =&gt; {
file =&gt; &quot;$home/.config/peace/peace.conf&quot;
}
);
my $dbh = Peace::DB-&gt;dbh( config =&gt; $config );</code></pre>
<h1 id="DESCRIPTION">DESCRIPTION</h1>
<p>This module helps to recover a database handle and runs the migrations automatically when doing so.</p>
<h1 id="FUNCTIONS">FUNCTIONS</h1>
<p>Peace::DB implements the following functions:</p>
<h2 id="dbh">dbh</h2>
<p>Recovers a database handle, requires the config of the app as its parameter.</p>
<pre><code>my $dbh = Peace::DB-&gt;dbh( config =&gt; $config );</code></pre>
<h2 id="run_migrations">run_migrations</h2>
<p>Runs the migrations manually.</p>
<pre><code>Peace::DB-&gt;run_migrations($dbh);</code></pre>
<h1 id="SEE-ALSO">SEE ALSO</h1>
<p><a>DBI</a>, <a>DBD::Pg</a>, <a href="/lib/Peace.html">Peace</a></p>
</body>
</html>