Permalink
Browse files

Rename user to username but support old name in constructor

  • Loading branch information...
1 parent ec23ae6 commit cbe7075c60fa51901490813d2219585da345b4c5 @autarch autarch committed Apr 1, 2013
Showing with 14 additions and 2 deletions.
  1. +14 −2 lib/Database/Migrator/Core.pm
@@ -29,7 +29,7 @@ has database => (
required => 1,
);
-has [qw( user password host port )] => (
+has [qw( username password host port )] => (
is => 'ro',
isa => Maybe [Str],
default => undef,
@@ -111,6 +111,18 @@ has dry_run => (
default => 0,
);
+around BUILDARGS => sub {
+ my $orig = shift;
+ my $class = shift;
+
+ my $p = $class->$orig(@_);
+
+ $p->{username} = delete $p->{user}
+ if exists $p->{user};
+
+ return $p;
+};
+
sub BUILD { }
after BUILD => sub {
my $self = shift;
@@ -321,7 +333,7 @@ provided via the command line or you can set defaults for them in a subclass.
The name of the database that will be created or migrated. This is required.
-=item * user, password, host, port
+=item * username, password, host, port
These parameters are used when connecting to the database. They are all
optional.

0 comments on commit cbe7075

Please sign in to comment.