From: Justin Hunter Date: Fri, 3 Jul 2009 21:56:46 +0000 (-0700) Subject: add support for sequences X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cc0972be996be6e521f94bb0a6b12b7fb82c2574;p=dbsrgits%2FSQL-Translator-2.0-ish.git add support for sequences --- diff --git a/lib/SQL/Translator/Object/Table.pm b/lib/SQL/Translator/Object/Table.pm index ed540cb..2a13e8a 100644 --- a/lib/SQL/Translator/Object/Table.pm +++ b/lib/SQL/Translator/Object/Table.pm @@ -3,7 +3,7 @@ use namespace::autoclean; use Moose; use MooseX::Types::Moose qw(HashRef Str); use MooseX::AttributeHelpers; -use SQL::Translator::Types qw(Column Constraint Index Schema); +use SQL::Translator::Types qw(Column Constraint Index Schema Sequence); use SQL::Translator::Object::Schema; extends 'SQL::Translator::Object'; @@ -55,6 +55,20 @@ has 'constraints' => ( required => 0 ); -__PACKAGE__->meta()->make_immutable; +has 'sequences' => ( + metaclass => 'Collection::Hash', + is => 'rw', + isa => HashRef[Sequence], + provides => { + exists => 'exists_sequence', + keys => 'sequence_ids', + get => 'get_sequence', + }, + curries => { set => { add_sequence => sub { my ($self, $body, $sequence) = @_; $self->$body($sequence->name, $sequence); } } }, + default => sub { {} }, + required => 0 +); + +__PACKAGE__->meta->make_immutable; 1;