+sub _upgrade_schema {
+ my ($class, %opts) = @_;
+
+ my $sql = '
+ DELETE FROM cust_msg WHERE NOT EXISTS
+ ( SELECT 1 FROM cust_main WHERE cust_main.custnum = cust_msg.custnum )
+ ';
+
+ my $sth = dbh->prepare($sql) or die dbh->errstr;
+ $sth->execute or die $sth->errstr;
+ '';
+
+}
+
+=back
+