Bug 14187 - DBRev 16.12.00.002

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Kyle Hall 2017-01-13 12:24:39 +00:00
parent ac3e4ce671
commit a2afebe115
4 changed files with 38 additions and 18 deletions

View file

@ -29,7 +29,7 @@ use vars qw{ $VERSION };
# - #4 : the developer version. The 4th number is the database subversion.
# used by developers when the database changes. updatedatabase take care of the changes itself
# and is automatically called by Auth.pm when needed.
$VERSION = "16.12.00.001";
$VERSION = "16.12.00.002";
sub version {
return $VERSION;

View file

@ -23,6 +23,12 @@ __PACKAGE__->table("branchtransfers");
=head1 ACCESSORS
=head2 branchtransfer_id
data_type: 'integer'
is_auto_increment: 1
is_nullable: 0
=head2 itemnumber
data_type: 'integer'
@ -66,6 +72,8 @@ __PACKAGE__->table("branchtransfers");
=cut
__PACKAGE__->add_columns(
"branchtransfer_id",
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
"itemnumber",
{
data_type => "integer",
@ -105,6 +113,18 @@ __PACKAGE__->add_columns(
{ data_type => "mediumtext", is_nullable => 1 },
);
=head1 PRIMARY KEY
=over 4
=item * L</branchtransfer_id>
=back
=cut
__PACKAGE__->set_primary_key("branchtransfer_id");
=head1 RELATIONS
=head2 frombranch
@ -153,8 +173,8 @@ __PACKAGE__->belongs_to(
);
# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:NPbH+5o2BVPj8yeoUqEavw
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2017-01-13 12:22:24
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8cnatLrGkNwyTo35PCOm2A
# You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -1,15 +0,0 @@
$DBversion = '16.12.00.XXX';
if ( CheckVersion($DBversion) ) {
unless (column_exists( 'branchtransfers', 'branchtransfer_id' )
and index_exists( 'branchtransfers', 'PRIMARY' ) )
{
$dbh->do(
"ALTER TABLE branchtransfers
ADD COLUMN branchtransfer_id int(12) NOT NULL auto_increment FIRST, ADD CONSTRAINT PRIMARY KEY (branchtransfer_id);"
);
}
# Always end with this (adjust the bug info)
SetVersion($DBversion);
print "Upgrade to $DBversion done (Bug 14187: branchtransfer needs a primary key (id) for DBIx and common sense.)\n";
}

View file

@ -13766,6 +13766,21 @@ if ( CheckVersion($DBversion) ) {
SetVersion($DBversion);
}
$DBversion = '16.12.00.002';
if ( CheckVersion($DBversion) ) {
unless (column_exists( 'branchtransfers', 'branchtransfer_id' )
and index_exists( 'branchtransfers', 'PRIMARY' ) )
{
$dbh->do(
"ALTER TABLE branchtransfers
ADD COLUMN branchtransfer_id int(12) NOT NULL auto_increment FIRST, ADD CONSTRAINT PRIMARY KEY (branchtransfer_id);"
);
}
SetVersion($DBversion);
print "Upgrade to $DBversion done (Bug 14187 - branchtransfer needs a primary key (id) for DBIx and common sense.)\n";
}
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
# SEE bug 13068
# if there is anything in the atomicupdate, read and execute it.