NAME
Beam::Make::DBI::Schema - A Beam::Make recipe to build database schemas
VERSION
version 0.003
SYNOPSIS
### container.yml
# A Beam::Wire container to configure a database connection to use
sqlite:
$class: DBI
$method: connect
$args:
- dbi:SQLite:conversion.db
### Beamfile
conversion.db:
$class: Beam::Wire::DBI::Schema
dbh: { $ref: 'container.yml:sqlite' }
schema:
- table: accounts
columns:
- account_id: VARCHAR(255) NOT NULL PRIMARY KEY
- address: TEXT NOT NULL
DESCRIPTION
This Beam::Make recipe class builds a database schema.
ATTRIBUTES
dbh
Required. The DBI database handle to use. Can be a reference to a service in a Beam::Wire container using { $ref: "<container>:<service>" }
.
schema
A list of tables to create. Each table is a mapping with the following keys:
- table
-
The name of the table to create.
- columns
-
A list of key/value pairs of columns. The key is the column name, the value is the SQL to use for the column definition.
SEE ALSO
AUTHOR
Doug Bell <preaction@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2020 by Doug Bell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.