| 1 | package Schedule::LongSteps::Storage::AutoDBIx::Schema::Result::LongstepProcess; | ||
| 2 | $Schedule::LongSteps::Storage::AutoDBIx::Schema::Result::LongstepProcess::VERSION = '0.023'; | ||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | use base qw/DBIx::Class::Core/; | ||
| 6 | __PACKAGE__->table('schedule_longsteps_process'); | ||
| 7 | __PACKAGE__->load_components(qw/InflateColumn::DateTime InflateColumn::Serializer/); | ||
| 8 | __PACKAGE__->add_columns( | ||
| 9 | id => | ||
| 10 | { data_type => "integer", is_auto_increment => 1, is_nullable => 0 }, | ||
| 11 | process_class => | ||
| 12 | { data_type => "varchar", is_nullable => 0, size => 255 }, | ||
| 13 | what => | ||
| 14 | { data_type => "varchar", is_nullable => 1, size => 255 }, | ||
| 15 | status => | ||
| 16 | { data_type => "varchar", is_nullable => 0, size => 50 , default_value => 'pending' }, | ||
| 17 | run_at => | ||
| 18 | { data_type => "datetime", datetime_undef_if_invalid => 1, is_nullable => 1 }, | ||
| 19 | run_id => | ||
| 20 | { data_type => "varchar", is_nullable => 1, size => 36 }, | ||
| 21 | state => | ||
| 22 | { data_type => "text", | ||
| 23 | serializer_class => 'JSON', | ||
| 24 | is_nullable => 0, | ||
| 25 | }, | ||
| 26 | error => | ||
| 27 | { data_type => "text", is_nullable => 1 } | ||
| 28 | ); | ||
| 29 | |||
| 30 | __PACKAGE__->set_primary_key("id"); | ||
| 31 | |||
| 32 | sub sqlt_deploy_hook { | ||
| 33 | my ($self, $sqlt_table) = @_; | ||
| 34 | $sqlt_table->add_index(name => 'idx_longprocess_run_id', fields => ['run_id']); | ||
| 35 | $sqlt_table->add_index(name => 'idx_longprocess_run_at', fields => ['run_at']); | ||
| 36 | } | ||
| 37 | 1; | ||
| 38 | |||
| 39 | __END__ |