Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Create the PacketFence ORM Classes from the Database
#!/usr/bin/env perl
use strict;
use warnings;
use Config::IniFiles;
use DBIx::Class::Schema::Loader qw/ make_schema_at /;
if( !-d './lib') {
die "must be run in the root dir of PacketFence!\n";
my $CFG = Config::IniFiles->new( -file => 'conf/pf.conf' ) or die "unable to source config file!\n";
dump_directory=> './lib',
exclude => qr/(^pg_)|(^v_admin)|(^v_history)/,
moniker_map => sub {
my $table = shift;
my %map = (
# Table => 'ClassName',
return $map{$table} if exists $map{$table};
my $class = $table;
$class =~ s/\_/::/g;
return $class;
skip_relationships => 1,
components => [qw(InflateColumn::DateTime PK::Auto)],
[ 'dbi:mysql:database=pf', 'pf', $CFG->val( 'database', 'pass' ) ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.