« blib/lib/auto/share/dist/Cmd-Dwarf/app/lib/Dwarf/Test.pm
↑ Summary
blib/lib/auto/share/dist/Cmd-Dwarf/app/lib/Dwarf/DSL.pm »
| 1 | package App::DB::Row; | ||
| 2 | use Dwarf::Pragma; | ||
| 3 | use parent 'Teng::Row'; | ||
| 4 | use Class::Method::Modifiers; | ||
| 5 | |||
| 6 | before update => \&will_update; | ||
| 7 | sub will_update { | ||
| 8 | my ($self, $update_row_data) = @_; | ||
| 9 | my $table = $self->{table}; | ||
| 10 | if (grep /^updated_at$/, @{ $table->columns }) { | ||
| 11 | $update_row_data->{updated_at} ||= \'NOW()'; | ||
| 12 | } | ||
| 13 | } | ||
| 14 | |||
| 15 | 1; |