From: Dagfinn Ilmari Mannsåker Date: Fri, 17 Aug 2012 13:07:45 +0000 (+0200) Subject: Reinstate schema object base class X-Git-Tag: v0.11013_01~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=954ed12e43bd40637cd4e5a08b6d24d1560ac2fa;p=dbsrgits%2FSQL-Translator.git Reinstate schema object base class This class consumes the roles common to all the schema classes, and maintains backwards compatibilty for DarkPAN code checking $obj->isa('SQL::Translator::Schema::Object'). --- diff --git a/lib/SQL/Translator/Schema.pm b/lib/SQL/Translator/Schema.pm index d05ebd0..756ec1a 100644 --- a/lib/SQL/Translator/Schema.pm +++ b/lib/SQL/Translator/Schema.pm @@ -36,12 +36,7 @@ use SQL::Translator::Schema::View; use SQL::Translator::Utils 'parse_list_arg'; use Carp; -with qw( - SQL::Translator::Role::Error - SQL::Translator::Role::BuildArgs - SQL::Translator::Schema::Role::Extra - SQL::Translator::Schema::Role::Compare -); +extends 'SQL::Translator::Schema::Object'; our $VERSION = '1.59'; diff --git a/lib/SQL/Translator/Schema/Constraint.pm b/lib/SQL/Translator/Schema/Constraint.pm index 5adb2ed..d81dd1a 100644 --- a/lib/SQL/Translator/Schema/Constraint.pm +++ b/lib/SQL/Translator/Schema/Constraint.pm @@ -29,12 +29,7 @@ use SQL::Translator::Utils qw(parse_list_arg ex2err throw); use SQL::Translator::Types qw(schema_obj); use List::MoreUtils qw(uniq); -with qw( - SQL::Translator::Role::Error - SQL::Translator::Role::BuildArgs - SQL::Translator::Schema::Role::Extra - SQL::Translator::Schema::Role::Compare -); +extends 'SQL::Translator::Schema::Object'; our $VERSION = '1.59'; diff --git a/lib/SQL/Translator/Schema/Field.pm b/lib/SQL/Translator/Schema/Field.pm index 8e4a0cb..25e8074 100644 --- a/lib/SQL/Translator/Schema/Field.pm +++ b/lib/SQL/Translator/Schema/Field.pm @@ -27,12 +27,7 @@ use SQL::Translator::Schema::Constants; use SQL::Translator::Types qw(schema_obj); use SQL::Translator::Utils qw(parse_list_arg ex2err throw); -with qw( - SQL::Translator::Role::Error - SQL::Translator::Role::BuildArgs - SQL::Translator::Schema::Role::Extra - SQL::Translator::Schema::Role::Compare -); +extends 'SQL::Translator::Schema::Object'; our $VERSION = '1.59'; diff --git a/lib/SQL/Translator/Schema/Index.pm b/lib/SQL/Translator/Schema/Index.pm index 22d194d..b3041a1 100644 --- a/lib/SQL/Translator/Schema/Index.pm +++ b/lib/SQL/Translator/Schema/Index.pm @@ -31,12 +31,7 @@ use SQL::Translator::Utils qw(parse_list_arg ex2err throw); use SQL::Translator::Types qw(schema_obj); use List::MoreUtils qw(uniq); -with qw( - SQL::Translator::Role::Error - SQL::Translator::Role::BuildArgs - SQL::Translator::Schema::Role::Extra - SQL::Translator::Schema::Role::Compare -); +extends 'SQL::Translator::Schema::Object'; our $VERSION = '1.59'; diff --git a/lib/SQL/Translator/Schema/Object.pm b/lib/SQL/Translator/Schema/Object.pm new file mode 100644 index 0000000..ef0fc05 --- /dev/null +++ b/lib/SQL/Translator/Schema/Object.pm @@ -0,0 +1,50 @@ +package SQL::Translator::Schema::Object; + +=head1 NAME + +SQL::Translator::Schema::Object - Base class for SQL::Translator schema objects + +=head1 SYNOPSIS + + package SQL::Translator::Schema::Foo; + use Moo; + extends 'SQL::Translator::Schema::Object'; + +=head1 DESCRIPTION + +Base class for Schema objects. A Moo class consuming the following +roles. + +=over + +=item L + +Provides C<< $obj->error >>, similar to L. + +=item L + +Removes undefined constructor arguments, for backwards compatibility. + +=item L + +Provides an C attribute storing a hashref of arbitrary data. + +=item L + +Provides an C<< $obj->equals($other) >> method for testing object +equality. + +=back + +=cut + +use Moo; + +with qw( + SQL::Translator::Role::Error + SQL::Translator::Role::BuildArgs + SQL::Translator::Schema::Role::Extra + SQL::Translator::Schema::Role::Compare +); + +1; diff --git a/lib/SQL/Translator/Schema/Procedure.pm b/lib/SQL/Translator/Schema/Procedure.pm index 8624a5d..0aa7701 100644 --- a/lib/SQL/Translator/Schema/Procedure.pm +++ b/lib/SQL/Translator/Schema/Procedure.pm @@ -32,12 +32,7 @@ use SQL::Translator::Utils qw(parse_list_arg ex2err); use SQL::Translator::Types qw(schema_obj); use List::MoreUtils qw(uniq); -with qw( - SQL::Translator::Role::Error - SQL::Translator::Role::BuildArgs - SQL::Translator::Schema::Role::Extra - SQL::Translator::Schema::Role::Compare -); +extends 'SQL::Translator::Schema::Object'; our $VERSION = '1.59'; diff --git a/lib/SQL/Translator/Schema/Table.pm b/lib/SQL/Translator/Schema/Table.pm index 3712306..754f910 100644 --- a/lib/SQL/Translator/Schema/Table.pm +++ b/lib/SQL/Translator/Schema/Table.pm @@ -30,12 +30,7 @@ use SQL::Translator::Schema::Index; use Carp::Clan '^SQL::Translator'; use List::Util 'max'; -with qw( - SQL::Translator::Role::Error - SQL::Translator::Role::BuildArgs - SQL::Translator::Schema::Role::Extra - SQL::Translator::Schema::Role::Compare -); +extends 'SQL::Translator::Schema::Object'; our $VERSION = '1.59'; diff --git a/lib/SQL/Translator/Schema/Trigger.pm b/lib/SQL/Translator/Schema/Trigger.pm index ae2d951..1381c77 100644 --- a/lib/SQL/Translator/Schema/Trigger.pm +++ b/lib/SQL/Translator/Schema/Trigger.pm @@ -33,12 +33,7 @@ use SQL::Translator::Utils qw(parse_list_arg ex2err throw); use SQL::Translator::Types qw(schema_obj); use List::MoreUtils qw(uniq); -with qw( - SQL::Translator::Role::Error - SQL::Translator::Role::BuildArgs - SQL::Translator::Schema::Role::Extra - SQL::Translator::Schema::Role::Compare -); +extends 'SQL::Translator::Schema::Object'; our $VERSION = '1.59'; diff --git a/lib/SQL/Translator/Schema/View.pm b/lib/SQL/Translator/Schema/View.pm index 2f51288..e7e57a7 100644 --- a/lib/SQL/Translator/Schema/View.pm +++ b/lib/SQL/Translator/Schema/View.pm @@ -28,12 +28,7 @@ use SQL::Translator::Utils qw(parse_list_arg ex2err); use SQL::Translator::Types qw(schema_obj); use List::MoreUtils qw(uniq); -with qw( - SQL::Translator::Role::Error - SQL::Translator::Role::BuildArgs - SQL::Translator::Schema::Role::Extra - SQL::Translator::Schema::Role::Compare -); +extends 'SQL::Translator::Schema::Object'; our $VERSION = '1.59';