DBIx::C...:prepare(3)

πŸ“¦ version 0.075, in opensuse-leap 16.0

πŸ’… DBIx::Class::Migration::Script::Help::prepare β€” the prepare command, bestie edition πŸŽ€

okay so this page is from DBIx::C...:prepare(3), part of the User Contributed Perl Documentation β€” and it's literally the whole glow-up guide for dbic-migration prepare. no cap, it's giving "let's make some migration files" energy and we're gonna walk through it together πŸ¦‹


✨ NAME ✨

DBIx::Class::Migration::Script::Help::prepare β€” Create migration files. that's the whole vibe. πŸ’–


🌸 SYNOPSIS 🌸

here's the moment, the main character entrance:

dbic-migration prepare \
  --lib=lib \
  --schema_class=MyApp::Schema

iconic. copy it exactly, don't come for me. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So what does this actually do? It creates a fixtures directory AND a migrations directory under target_dir (but only if they don't already exist, she's not out here duplicating) and makes deployment files for the current schema. 🫢

BUT β€” and this is the important part β€” if deployment files already exist, it will fail unless you use overwrite_migrations. like, it's not gonna just steamroll your stuff. respect. 😌

The migrations directory reflects a directory structure as documented in DBIx::Class::DeploymentHandler. so if you're like "what's all this folder structure about", go read that, iykyk. πŸ“

If this is the first version, we create directories and initial DLL, etc. (yes, it says DLL, that's what the page says, don't @ me πŸ’€). For versions greater than 1, we will also generate diffs and copy any fixture configs etc (as well as generating a fresh 'all_table.json' fixture config). ✨

For safety reasons, we never overwrite any fixture configs (even if overwrite_migrations is true.) πŸ”₯ So your fixture configs are safe, periodt. put them down, they're protected.

πŸ‘‘ OPTIONS πŸ‘‘

This command accepts the following options. You may learn more about each option by typing dbic-migration help OPTION. The following is a summary. (yes bestie, there's a whole help system, go explore 🌈)

πŸŽ€ includes

  • Aliases: I, lib, libs, include

Accepts String, Optional.

Adds the listed paths to @INC. Handy during development when you want to use a development schema class. lowkey the move when you're still cooking your schema locally 🧚

πŸŽ€ schema_class (S)

Accepts Str. Required.

This is the schema we use as the basis for creating, managing and running your deployments. This should be the full package namespace defining your subclass of DBIx::Class::Schema. For example MyApp::Schema. this is THE foundation, she's the blueprint πŸ’œ

If the schema_class cannot be loaded, a hard exception will be thrown. 😭 no soft vibes, no gentle warning β€” it's a whole hard exception. make sure that class actually loads, bestie.

πŸŽ€ force_overwrite (O)

Optional. Bool.

Usually if you've already prepared migration files for the current version as specified in your schema_class we don't write out files even if you call prepare. If you want to force overwrite previously prepared files (and lose all your customizations) you can do so with this option. ⚠️

like… lose all your customizations. read that again. that's the trade, and it's a real one bestie, so be sure before you commit. πŸ™ˆ

This option won't overwrite previously existing fixture configuration files. so at least those are still safe 🫢

πŸŽ€ target_dir (D)

Optional. String (Path to directory).

When using a sandbox_class for generating developer level database sandboxes, you may wish to place the sandbox in a directory other than the default (which is under the share directory off the project root). so like, if the default spot isn't it for you, this is your moment to pick a different one 🌸

πŸŽ€ databases

  • Aliases: database

Value: Str or Array of Str (default: SQLite). Optional.

By default we create migrations for SQLite. You can use this option to change that default, or to write our migrations for more than one database. multi-database era, we love to see it πŸ’–

You can prepare deployment for any database type that SQL::Translator understands. that's the range, and it's wide πŸ”₯

dbic-migration prepare --database SQLite --database MySQL --PostgreSQL
Please note if you choose to manually set this value, you won't automatically get the default or inferred type. so like, set it on purpose and know what you're doing πŸ‘€

πŸŽ€ sandbox_class

  • Aliases: T, sb

Accepts: String (default: SqliteSandbox)

The class we use to create a developer level database sandbox. πŸ–οΈ

You can change this to either 'PostgresqlSandbox' or 'MySQLSandbox', which will create a sandbox using DBIx::Class::Migration::MySQLSandbox or DBIx::Class::Migration::PostgresqlSandbox. pick your fighter πŸ’…

πŸŽ€ user

  • Aliases: U

(that's it, that's the entry β€” the page keeps it short and sweet πŸŽ€)

πŸŽ€ password

  • Aliases: P

(same vibe, short and sweet, no extra detail on this page ✨)

πŸŽ€ dsn

Connection information to an already created and running instance of a database. If you don't specify this, we will assume you want a developer level sandbox ( See sandbox). so like, no dsn = sandbox time, that's the deal πŸ¦‹


⭐ SEE ALSO ⭐

go click around, bestie, the whole ecosystem is right here:

  • DBIx::Class::Migration
  • DBIx::Class::Migration::Script
  • DBIx::Class::Migration::Features
  • DBIx::Class::Migration::Tutorial

πŸ’– AUTHOR πŸ’–

See DBIx::Class::Migration for author information β€” the receipts live over there 🫢


See DBIx::Class::Migration for copyright and license information β€” same, all the legal bits are on that page πŸ‘‘


and that's the whole page, no crumbs left πŸ’… this was rendered for ya by perl v5.42.0, dated 2020-06-03, and yeah, the footer knows it's DBIx::C...:prepare(3) β€” go prep those migrations, bestie, you're gonna slay πŸ¦‹βœ¨πŸŽ€

πŸ“¦ where this page comes from