kentnl / App-DH

Deploy your DBIx::Class Schema to DDL/Database via DBIx::Class::DeploymentHandler
Other
0 stars 1 forks source link

How to add table 'dbix_class_deploymenthandler_versions' to existing database? #4

Open dboehmer opened 7 years ago

dboehmer commented 7 years ago

I happen to have existing software projects with deployed databases. Now I want to add migrations via App::DH. Could you add a command or provide a one-liner for adding the meta table dbix_class_deploymenthandler_versions?

Currently I do this by copying the whole database to a temporary database, installing the database from scratch and copying data back to the new tables. But this tedious to do, error-prone and might be a hard or impossible task for large databases or without sufficient rights for creating a (temporary) database.

dboehmer commented 7 years ago

I found out that

$dh->prepare_version_storage_install
$dh->install_version_storage

installs the meta table next to preexisting schema tables but it is only populated when the schema classes are actually created. Makes sense in a way but how to get that, too?

kentfredric commented 7 years ago

Do you have a recommended approach you'd prefer here? ( ie: specific command names )

I might instead be more motivated to structure the code to be more amenable to users adding their own custom commands in subclasses, that way if this is what it seems, very user-case specific, you can easily extend your custom deployment wrapper to do this.