« lib/Mojolicious/Plugin/Fondation/Workflow/Proxy.pm
↑ Summary
blib/lib/Mojolicious/Plugin/Fondation/Workflow/Schema/Result/WorkflowHistory.pm »
| 1 | package Mojolicious::Plugin::Fondation::Workflow::Schema::Result::Workflow; | ||
| 2 | $Mojolicious::Plugin::Fondation::Workflow::Schema::Result::Workflow::VERSION = '0.02'; | ||
| 3 | # ABSTRACT: DBIx::Class Result for the `workflow` table | ||
| 4 | # | ||
| 5 | # Column names match Workflow::Persister::DBI expectations: | ||
| 6 | # workflow_id, type, state, last_update | ||
| 7 | # Bonus columns: resource_type, resource_id | ||
| 8 | |||
| 9 | use strict; | ||
| 10 | use warnings; | ||
| 11 | |||
| 12 | use base 'Mojolicious::Plugin::Fondation::Schema::Result::Base'; | ||
| 13 | |||
| 14 | __PACKAGE__->load_components(qw/Core/); | ||
| 15 | __PACKAGE__->table('workflow'); | ||
| 16 | |||
| 17 | __PACKAGE__->add_columns( | ||
| 18 | workflow_id => { | ||
| 19 | data_type => 'integer', | ||
| 20 | is_auto_increment => 1, | ||
| 21 | is_nullable => 0, | ||
| 22 | }, | ||
| 23 | type => { | ||
| 24 | data_type => 'varchar', | ||
| 25 | size => 100, | ||
| 26 | is_nullable => 0, | ||
| 27 | }, | ||
| 28 | state => { | ||
| 29 | data_type => 'varchar', | ||
| 30 | size => 100, | ||
| 31 | is_nullable => 0, | ||
| 32 | }, | ||
| 33 | last_update => { | ||
| 34 | data_type => 'varchar', | ||
| 35 | size => 100, | ||
| 36 | is_nullable => 0, | ||
| 37 | }, | ||
| 38 | resource_type => { | ||
| 39 | data_type => 'varchar', | ||
| 40 | size => 255, | ||
| 41 | is_nullable => 1, | ||
| 42 | }, | ||
| 43 | resource_id => { | ||
| 44 | data_type => 'varchar', | ||
| 45 | size => 255, | ||
| 46 | is_nullable => 1, | ||
| 47 | }, | ||
| 48 | ); | ||
| 49 | |||
| 50 | __PACKAGE__->set_primary_key('workflow_id'); | ||
| 51 | |||
| 52 | __PACKAGE__->has_many( | ||
| 53 | 'workflow_histories', | ||
| 54 | 'Mojolicious::Plugin::Fondation::Workflow::Schema::Result::WorkflowHistory', | ||
| 55 | 'workflow_id', | ||
| 56 | ); | ||
| 57 | |||
| 58 | 1; | ||
| 59 | |||
| 60 | __END__ |