Permalink
Browse files

* 10_cluster_dbi.t now proves what it set out to prove!

 * Updated all the schema's to accomidate the new mq_id part of 'in_use_by'
  • Loading branch information...
1 parent c307e95 commit 717d0d0df58406ba8adc828a7bf1da872ed891c8 @dsnopek committed Jun 17, 2010
@@ -57,7 +57,7 @@ CREATE TABLE messages
message_id varchar(255) primary key,
destination varchar(255) not null,
persistent char(1) default 'Y' not null,
- in_use_by int,
+ in_use_by varchar(255),
body text,
timestamp decimal(15,5),
size int,
@@ -91,7 +91,7 @@ sub _do_schema
sub _upgrade
{
my $dbh = shift;
- my @versions = ('0.1.7', '0.1.8', '0.2.3', '0.2.9');
+ my @versions = ('0.1.7', '0.1.8', '0.2.3', '0.2.9', '0.2.10');
# Funny lexical scoping rules require this to be an anonymous sub or weird
# things will happen with $dbh
@@ -115,9 +115,10 @@ sub _upgrade
};
return (!$@);
},
- '0.1.8' => sub { $meta_version->('0.1.8') },
- '0.2.3' => sub { $meta_version->('0.2.3') },
- '0.2.9' => sub { $meta_version->('0.2.9') },
+ '0.1.8' => sub { $meta_version->('0.1.8') },
+ '0.2.3' => sub { $meta_version->('0.2.3') },
+ '0.2.9' => sub { $meta_version->('0.2.9') },
+ '0.2.10' => sub { $meta_version->('0.2.9') },
);
my %repairs = (
@@ -184,6 +185,14 @@ sub _upgrade
# update the version
$dbh->do("UPDATE meta SET value = '0.2.9' where key = 'version'");
},
+ '0.2.10' => sub {
+ # NOTE: Here we *would* change in_use_by from INT to VARCHAR(255) but
+ # not only is that not possible via SQLite3's ALTER statement, but it makes
+ # no difference what so ever in SQLite3.
+
+ # update the version
+ $dbh->do("UPDATE meta SET value = '0.2.10' where key = 'version'");
+ }
);
my $do_repairs = 0;
@@ -237,7 +246,7 @@ sub _make_db
{
_do_schema($dbh, MESSAGES_SCHEMA);
_do_schema($dbh, META_SCHEMA);
- $dbh->do(q{INSERT INTO meta (key, value) VALUES ('version', '0.2.3')});
+ $dbh->do(q{INSERT INTO meta (key, value) VALUES ('version', '0.2.10')});
}
$dbh->disconnect();
}
View
@@ -4,14 +4,14 @@ CREATE TABLE meta
`key` varchar(255) primary key,
`value` varchar(255)
);
-INSERT INTO meta (`key`, `value`) VALUES ('version', '0.2.3');
+INSERT INTO meta (`key`, `value`) VALUES ('version', '0.2.10');
CREATE TABLE messages
(
message_id varchar(255) primary key,
destination varchar(255) not null,
persistent enum('1', '0') default '1' not null,
- in_use_by int,
+ in_use_by varchar(255),
body text,
timestamp decimal(15,5),
size int,
View
@@ -4,14 +4,14 @@ CREATE TABLE meta
key varchar(255) primary key,
value varchar(255)
);
-INSERT INTO meta (key, value) VALUES ('version', '0.2.3');
+INSERT INTO meta (key, value) VALUES ('version', '0.2.10');
CREATE TABLE messages
(
message_id varchar(255) primary key,
destination varchar(255) not null,
persistent char(1) default '1' not null,
- in_use_by int,
+ in_use_by varchar(255),
body text,
timestamp decimal(15,5),
size int,
@@ -0,0 +1,5 @@
+
+ALTER TABLE messages MODIFY COLUMN in_use_by VARCHAR(255);
+
+UPDATE meta SET value = '0.2.10' WHERE `key` = 'version';
+
View
@@ -89,6 +89,7 @@ lives_ok {
} 'MQ1: client 1 subscribed and sent message';
ok($message = $client1a->receive_frame(), 'MQ1: client 1 claimed message');
+sleep 2;
# next, client 1 connects and disconnects to MQ2
ok($client1b = stomp_connect(8100), 'MQ2: client 1 connects');

0 comments on commit 717d0d0

Please sign in to comment.