DBIO
view release on metacpan or search on metacpan
lib/DBIO/Manual/Heritage.pod view on Meta::CPAN
=item L<DBIO::Row/TO_JSON> - serializable hashref, excludes blob/text columns
=item L<DBIO::Row/serializable_columns> - list of serializable column names
=item L<DBIO::Row/self_rs> - a ResultSet scoped to this row
=item L<DBIO::Row/get_storage_value> - original DB value before in-memory changes
=item L<DBIO::Row/before_column_change> - fire a callback before a column is modified
=item L<DBIO::Row/after_column_change> - fire a callback after a column is modified
=item L<DBIO::Row/around_column_change> - wrap a column update with an around-style hook
=item L<DBIO::Row/proxy_resultset_method> - expose a ResultSet C<with_*> method as a row accessor
=back
These come from C<DBIx::Class::Helper::Row::StorageValues>,
C<DBIx::Class::Helper::Row::OnColumnChange>, and
C<DBIx::Class::Helper::ResultSet::ProxyResultSetMethod>.
=head2 IntrospectableM2M (was DBIx::Class::IntrospectableM2M)
Many-to-many introspection is integrated into
L<DBIO::Relationship::ManyToMany>. The C<_m2m_metadata> structure is
populated automatically when you declare a C<many_to_many> relationship. No
C<load_components> needed.
Accessible fields: C<accessor>, C<relation>, C<foreign_relation>,
C<rs_method>, C<add_method>, C<set_method>, C<remove_method>.
=head2 DBIO::UUIDColumns (was DBIx::Class::UUIDColumns)
Auto-generate UUID values on insert. Mark columns with:
uuid_columns('id'); # Vanilla/Candy
col id => uuid, auto_inc; # Cake (uses uuid_columns internally)
The UUID class defaults to the first available among C<Data::UUID>,
C<UUID>, C<UUID::Random>. Override with C<uuid_class()>.
See L<DBIO::UUIDColumns>.
=head2 DBIO::EncodedColumn
One-way encoding of column values (passwords, tokens). Mark a column:
__PACKAGE__->add_columns(
password => {
data_type => 'varchar',
size => 100,
encode_column => 1,
encode_class => 'Digest',
encode_args => { algorithm => 'SHA-256', format => 'hex' },
encode_check_method => 'check_password',
},
);
The column is encoded transparently on write. The C<check_password>
(or whatever name you give C<encode_check_method>) method is generated
automatically on the Result class.
Storage format: C<dbio$E<lt>algoE<gt>$E<lt>salt_b64E<gt>$E<lt>digest_b64E<gt>>.
See L<DBIO::EncodedColumn>.
=head2 DBIO::HashAccessor
Accessor generation for serialized hash columns (JSON, YAML, MessagePack):
__PACKAGE__->add_hash_accessor('metadata', 'metadata_col');
Generates: C<metadata()>, C<metadata_hash()>, C<metadata_hash_delete()>,
C<metadata_push()>, C<metadata_shift()>.
See L<DBIO::HashAccessor>.
=head2 InflateColumn::Serializer (JSON, YAML, MessagePack)
Serialize complex Perl structures to a text/blob column. Available via
C<load_components('InflateColumn::Serializer')>. Serializer options:
C<JSON>, C<YAML>, C<Sereal>, C<MsgPack>.
=head2 PopulateMore (was DBIx::Class::PopulateMore)
Enhanced C<populate()> that supports cross-source references, fixture
data from files, and batch inserts. Integrated into L<DBIO::Schema>.
The invocation syntax is unchanged:
$schema->populate([ Users => ... ]);
=head1 NEW CONCEPTS
These features did not exist in DBIx::Class in any form.
=head2 DBIO::ChangeLog - audit trail per Result class
Automatic row-level change tracking. Add to a Result class:
__PACKAGE__->load_components('ChangeLog');
DBIO creates a companion table C<E<lt>tableE<gt>_changelog> automatically.
By default every column change is recorded (INSERT, UPDATE, DELETE).
Exclude sensitive columns:
__PACKAGE__->changelog_exclude_columns(qw/ password_hash session_token /);
Changes are stored as JSON. Methods:
$row->changelog_entries(); # ResultSet of log rows
$schema->changelog_serialize_changes($hashref);
$schema->changelog_deserialize_changes($json_str);
PostgreSQL storage can use native C<jsonb> for the changes column.
The version table was renamed from C<dbix_class_schema_versions> to
C<dbio_schema_versions>.
See L<DBIO::ChangeLog> and L<DBIO::ChangeLog::Schema>.
( run in 3.676 seconds using v1.01-cache-2.11-cpan-a49fcb8fa48 )