[Opendnssec-user] Exporting database schema version is not supported for conversion

Yuri Schaeffer yuri at nlnetlabs.nl
Wed Mar 22 10:51:57 UTC 2017


Hi Arun,

Can you apply these changes to the convert_database.pl script and let me
know if that helped?

Regards,
//Yuri

diff --git a/enforcer/utils/convert_database.pl
b/enforcer/utils/convert_database.pl
index 896e14618..d14ce82e0 100755
--- a/enforcer/utils/convert_database.pl
+++ b/enforcer/utils/convert_database.pl
@@ -158,7 +158,7 @@ $sth->finish;
 #

 my $from_version_valid = 0;
-if ($from_version == 3) {
+if ($from_version == 4) {
     $from_version_valid = 1;
 }

@@ -172,7 +172,7 @@ unless ($from_version_valid) {
 #

 if ($to_data_source eq 'mysql') {
-    if ($from_version == 3) {
+    if ($from_version == 4) {
         my $valid = 1;
         print 'Validating existing data', "\n";

@@ -403,7 +403,7 @@ unless ($from_version == $to_version) {
 # Convert the database
 #

-if ($from_version == 3) {
+if ($from_version == 4) {
     #
     # Schema version 3 does not need any data modifications so just
dump it out and in
     #
@@ -447,7 +447,7 @@ if ($from_version == 3) {
         { dnsseckeys => {
             delete => 'DELETE FROM dnsseckeys',
             select => 'SELECT * FROM dnsseckeys',
-            insert => 'INSERT INTO dnsseckeys VALUES ( ?, ?, ?, ?, ?,
?, ?, ?, ?, ? )'
+            insert => 'INSERT INTO dnsseckeys VALUES ( ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ? )'
         }},
         { parameters_policies => {
             delete => 'DELETE FROM parameters_policies',


On 22-03-17 10:40, Arun Natarajan wrote:
> Hi,
> 
>  Trying to convert sqlite kasp.db (1.4.8) to MySQL but getting the
> following error:
> 
> # ./convert_database.pl <http://convert_database.pl> --from
> dbi:SQLite:dbname=/var/opendnssec/kasp.db --to
> dbi:mysql:database=kasp;host=localhost --to-username kasp --to-password kasp
> 
> Connected to exporting database dbi:SQLite:dbname=/var/opendnssec/kasp.db
> ./convert_database.pl <http://convert_database.pl>: Exporting database
> schema version is not supported for conversion.
> bash: --to-username: command not found
> 
> The kasp.db was originally created for 1.4.7 and later converted to 1.4.8.
> 
> $ sqlite3 /var/opendnssec/kasp.db
> SQLite version 3.7.17 2013-05-20 00:56:22
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite> alter table dnsseckeys add column rfc5011 tinyint default 0;
> sqlite> alter table dnsseckeys add column revoked tinyint default 0;
> sqlite> drop view if exists KEYDATA_VIEW;
> sqlite> create view KEYDATA_VIEW as
>    ...> select k.id <http://k.id> as id, d.state as state, k.generate as
> generate, d.publish as publish,
>    ...>     d.ready as ready, d.active as active, d.retire as retire,
> d.dead as dead,
>    ...>     d.keytype as keytype, k.algorithm as algorithm, k.HSMkey_id
> as location,
>    ...>     d.zone_id as zone_id, k.policy_id as policy_id,
>    ...>     k.securitymodule_id as securitymodule_id, k.size as size,
>    ...>     k.compromisedflag as compromisedflag,
>    ...>     k.fixedDate as fixedDate,
>    ...>     d.rfc5011 as rfc5011, d.revoked as revoked
>    ...> from  keypairs k left outer join dnsseckeys d
>    ...> on k.id <http://k.id> = d.keypair_id;
> sqlite> insert into parameters (name, description, category_id) select
> "revoked", "key is revoked?", id from categories where name="ksk";
> sqlite> update dbadmin set version = 4;
> sqlite> .exit
> 
> appreciate your help.
> 
> thanks,
> arun
> 
> 
> _______________________________________________
> Opendnssec-user mailing list
> Opendnssec-user at lists.opendnssec.org
> https://lists.opendnssec.org/mailman/listinfo/opendnssec-user
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: OpenPGP digital signature
URL: <http://lists.opendnssec.org/pipermail/opendnssec-user/attachments/20170322/99d23c0a/attachment.bin>


More information about the Opendnssec-user mailing list