| 1 | package Mojolicious::Plugin::Fondation::Workflow::Schema::Result::WorkflowHistory; | ||
| 2 | $Mojolicious::Plugin::Fondation::Workflow::Schema::Result::WorkflowHistory::VERSION = '0.02'; | ||
| 3 | # ABSTRACT: DBIx::Class Result for the `workflow_history` table | ||
| 4 | # | ||
| 5 | # Column names match Workflow::Persister::DBI expectations: | ||
| 6 | # workflow_hist_id, workflow_id, action, description, state, workflow_user, history_date | ||
| 7 | # Bonus columns: user_id, comment, from_state, to_state | ||
| 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_history'); | ||
| 16 | |||
| 17 | __PACKAGE__->add_columns( | ||
| 18 | workflow_hist_id => { | ||
| 19 | data_type => 'integer', | ||
| 20 | is_auto_increment => 1, | ||
| 21 | is_nullable => 0, | ||
| 22 | }, | ||
| 23 | workflow_id => { | ||
| 24 | data_type => 'integer', | ||
| 25 | is_nullable => 0, | ||
| 26 | }, | ||
| 27 | action => { | ||
| 28 | data_type => 'varchar', | ||
| 29 | size => 100, | ||
| 30 | is_nullable => 0, | ||
| 31 | }, | ||
| 32 | description => { | ||
| 33 | data_type => 'text', | ||
| 34 | is_nullable => 1, | ||
| 35 | }, | ||
| 36 | state => { | ||
| 37 | data_type => 'varchar', | ||
| 38 | size => 100, | ||
| 39 | is_nullable => 0, | ||
| 40 | }, | ||
| 41 | workflow_user => { | ||
| 42 | data_type => 'varchar', | ||
| 43 | size => 255, | ||
| 44 | is_nullable => 1, | ||
| 45 | }, | ||
| 46 | history_date => { | ||
| 47 | data_type => 'varchar', | ||
| 48 | size => 100, | ||
| 49 | is_nullable => 0, | ||
| 50 | }, | ||
| 51 | # ── Fondation bonus columns (not used by Workflow::Persister::DBI) ── | ||
| 52 | user_id => { | ||
| 53 | data_type => 'integer', | ||
| 54 | is_nullable => 1, | ||
| 55 | }, | ||
| 56 | comment => { | ||
| 57 | data_type => 'text', | ||
| 58 | is_nullable => 1, | ||
| 59 | }, | ||
| 60 | from_state => { | ||
| 61 | data_type => 'varchar', | ||
| 62 | size => 100, | ||
| 63 | is_nullable => 1, | ||
| 64 | }, | ||
| 65 | to_state => { | ||
| 66 | data_type => 'varchar', | ||
| 67 | size => 100, | ||
| 68 | is_nullable => 1, | ||
| 69 | }, | ||
| 70 | ); | ||
| 71 | |||
| 72 | __PACKAGE__->set_primary_key('workflow_hist_id'); | ||
| 73 | |||
| 74 | __PACKAGE__->belongs_to( | ||
| 75 | 'workflow', | ||
| 76 | 'Mojolicious::Plugin::Fondation::Workflow::Schema::Result::Workflow', | ||
| 77 | { 'foreign.workflow_id' => 'self.workflow_id' }, | ||
| 78 | ); | ||
| 79 | |||
| 80 | 1; | ||
| 81 | |||
| 82 | __END__ |