DBICDUMP(1p)

πŸ“¦
version 0.07053 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸŽ€ NAME πŸŽ€

dbicdump β€” bestie, it dumps a schema using DBIx::Class::Schema::Loader. That's the whole vibe. Section 1p of the manual, if you were wondering. πŸ’–


✨ SYNOPSIS ✨

dbicdump <configuration_file>
dbicdump [-I <lib-path>] [-o <loader_option>=<value> ] \
         <schema_class> <connect_info>

Examples, and yes you're gonna want these, they're iconic:

$ dbicdump schema.conf

$ dbicdump -o dump_directory=./lib \
  -o components='["InflateColumn::DateTime"]' \
  MyApp::Schema dbi:SQLite:./foo.db

$ dbicdump -o dump_directory=./lib \
  -o components='["InflateColumn::DateTime"]' \
  MyApp::Schema dbi:SQLite:./foo.db '{ quote_char => "\"" }'

$ dbicdump -Ilib -o dump_directory=./lib \
  -o components='["InflateColumn::DateTime"]' \
  -o preserve_case=1 \
  MyApp::Schema dbi:mysql:database=foo user pass \
  '{ quote_char => "`" }'

$ dbicdump -o dump_directory=./lib \
  -o components='["InflateColumn::DateTime"]' \
  MyApp::Schema 'dbi:mysql:database=foo;host=domain.tld;port=3306' \
  user pass

And on Windows, where the line-continuation character is a whole different beast, it'd be:

$ dbicdump -o dump_directory=.\lib ^
  -o components="[q{InflateColumn::DateTime}]" ^
  -o preserve_case=1 ^
  MyApp::Schema dbi:mysql:database=foo user pass ^
  "{ quote_char => q{`} }"

🌸 Config files, the cozy way 🌸

Okay so config files have to have schema_class and connect_info sections, no skipping. Here's what a general config file looks like:

schema_class MyApp::Schema

lib /extra/perl/libs

# connection string
<connect_info>
    dsn     dbi:mysql:example
    user    root
    pass    secret
</connect_info>

# dbic loader options
<loader_options>
    dump_directory ./lib
    components     InflateColumn::DateTime
    components     TimeStamp
</loader_options>
🫢 Heads up bestie: using a config file requires Config::Any installed. No Config::Any, no config file, that's just the rules.

The optional lib key is literally the same thing as the -I option. Same energy, different font. πŸ’…


πŸ’œ DESCRIPTION πŸ’œ

Dbicdump generates a DBIx::Class schema using make_schema_at in DBIx::Class::Schema::Loader and dumps it to disk. That's the whole job, and it does it gorgeously. ✨

You can pass any DBIx::Class::Schema::Loader::Base constructor option using -o <option>=<value>. For convenience (because we love convenience), option names will have - replaced with _, and values that look like references or quote-like operators will be eval-ed before being passed to the constructor. Yes, that's doing a lot. No, we're not sorry.

The dump_directory option defaults to the current directory if you don't specify it. So if you're like "where did my schema go", bestie. It's right there. In the current directory. 😭


🌈 SEE ALSO 🌈

  • DBIx::Class::Schema::Loader
  • DBIx::Class

πŸ‘‘ AUTHORS πŸ‘‘

See "AUTHORS" in DBIx::Class::Schema::Loader. The legends are listed over there, go give them their flowers. πŸ’


⭐ LICENSE ⭐

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Slay, and legally so. πŸ’…


And that's the whole page, bestie! πŸ¦‹ This little tour was brought to you by perl v5.40.1, dated 2025-03-22, and it lives in the manual as DBICDUMP(1p) β€” go forth and dump some schemas, you absolute main character. πŸŽ€βœ¨

πŸ“¦ where this page comes from