frioux / DBIx-Class-DeploymentHandler

https://metacpan.org/pod/DBIx::Class::DeploymentHandler
20 stars 25 forks source link

Can't upgrade DB to new Schema from an existing DB without DeploymentHandler #45

Closed MileanCo closed 5 years ago

MileanCo commented 8 years ago

This module doesn't work to bring an old DB up to speed.


[j@eagle bin]$ perl upgrade_db.pl
Connecting to 'dbi:SQLite:dbname=/x/eng/testbedN,rtp/performance_hpa/perfqa_10g/DTB2/hosts_info3.sqlite'
INSTALL UNVERSIONED
[j@eagle bin]$

[j@eagle bin]$ perl upgrade_db.pl
Connecting to 'dbi:SQLite:dbname=/x/eng/testbedN,rtp/performance_hpa/perfqa_10g/DTB2/hosts_info3.sqlite'
UPGRADE
No previous schema file found (sql/_source/deploy/1/001-auto.yml) at /u/perfqa/perl5/perlbrew/perls/perl-5.14.0-threaded/lib/site_perl/5.14.0/x86_64-linux-thread-multi/Moose/Meta/Method/Delegation.pm line 110.
failed to run SQL in sql/SQLite/upgrade/1-2/001-auto.sql: DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::try {...} (): DBI Exception: DBD::SQLite::db do failed: table host already exists at /u/perfqa/perl5/perlbrew/perls/perl-5.14.0-threaded/lib/site_perl/5.14.0/x86_64-linux-thread-multi/Moose/Meta/Method/Delegation.pm line 110
 (running line 'CREATE TABLE host ( id INTEGER PRIMARY KEY NOT NULL, hostname text NOT NULL, os_build text, os_type text, named_reservation_info_id int, type text NOT NULL, cluster_mode text, cluster_label text, FOREIGN KEY (named_reservation_info_id) REFERENCES named_reservation_info(id) ON DELETE CASCADE ON UPDATE CASCADE )') at /u/perfqa/perl5/perlbrew/perls/perl-5.14.0-threaded/lib/site_perl/5.14.0/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm line 243.
DBIx::Class::Storage::TxnScopeGuard::DESTROY(): A DBIx::Class::Storage::TxnScopeGuard went out of scope without explicit commit or error. Rolling back. at /u/perfqa/perl5/perlbrew/perls/perl-5.14.0-threaded/lib/site_perl/5.14.0/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm line 281
DBIx::Class::Storage::TxnScopeGuard::DESTROY(): A DBIx::Class::Storage::TxnScopeGuard went out of scope without explicit commit or error. Rolling back. at /u/perfqa/perl5/perlbrew/perls/perl-5.14.0-threaded/lib/site_perl/5.14.0/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm line 281
[j@eagle bin]$

Using the version_storage trick here and the upgrade portion here

frioux commented 8 years ago

There's not enough information in this issue for me to take any reasonable action. I can assure you that the module does work with existing databases as that's how I've used it myself.

sent from a rotary phone, pardon my brevity On Apr 15, 2016 10:47 AM, "Joel Stenkvist" notifications@github.com wrote:

This module doesn't work to bring an old DB up to speed.

[j@eagle bin]$ perl upgrade_db.pl Connecting to 'dbi:SQLite:dbname=/x/eng/testbedN,rtp/performance_hpa/perfqa_10g/DTB2/hosts_info3.sqlite' INSTALL UNVERSIONED [j@eagle bin]$

[j@eagle bin]$ perl upgrade_db.pl Connecting to 'dbi:SQLite:dbname=/x/eng/testbedN,rtp/performance_hpa/perfqa_10g/DTB2/hosts_info3.sqlite' UPGRADE No previous schema file found (sql/_source/deploy/1/001-auto.yml) at /u/perfqa/perl5/perlbrew/perls/perl-5.14.0-threaded/lib/site_perl/5.14.0/x86_64-linux-thread-multi/Moose/Meta/Method/Delegation.pm line 110. failed to run SQL in sql/SQLite/upgrade/1-2/001-auto.sql: DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::try {...} (): DBI Exception: DBD::SQLite::db do failed: table host already exists at /u/perfqa/perl5/perlbrew/perls/perl-5.14.0-threaded/lib/site_perl/5.14.0/x86_64-linux-thread-multi/Moose/Meta/Method/Delegation.pm line 110 (running line 'CREATE TABLE host ( id INTEGER PRIMARY KEY NOT NULL, hostname text NOT NULL, os_build text, os_type text, named_reservation_info_id int, type text NOT NULL, cluster_mode text, cluster_label text, FOREIGN KEY (named_reservation_info_id) REFERENCES named_reservation_info(id) ON DELETE CASCADE ON UPDATE CASCADE )') at /u/perfqa/perl5/perlbrew/perls/perl-5.14.0-threaded/lib/site_perl/5.14.0/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm line 243. DBIx::Class::Storage::TxnScopeGuard::DESTROY(): A DBIx::Class::Storage::TxnScopeGuard went out of scope without explicit commit or error. Rolling back. at /u/perfqa/perl5/perlbrew/perls/perl-5.14.0-threaded/lib/site_perl/5.14.0/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm line 281 DBIx::Class::Storage::TxnScopeGuard::DESTROY(): A DBIx::Class::Storage::TxnScopeGuard went out of scope without explicit commit or error. Rolling back. at /u/perfqa/perl5/perlbrew/perls/perl-5.14.0-threaded/lib/site_perl/5.14.0/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm line 281 [j@eagle bin]$

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/frioux/DBIx-Class-DeploymentHandler/issues/45

mohawk2 commented 5 years ago

@MileanCo We're going to need steps to reproduce this, from scratch, on my computer. Please reopen this issue with that info :-)