| 1 | package App::DrivePlayer::Schema::Result::Track; | ||
| 2 | |||
| 3 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 2 | ▶ | use base 'DBIx::Class::Core'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 2 | __PACKAGE__->table('tracks'); | |
| 8 | |||
| 9 | 2 | __PACKAGE__->add_columns( | |
| 10 | id => { | ||
| 11 | data_type => 'integer', | ||
| 12 | is_auto_increment => 1, | ||
| 13 | is_nullable => 0, | ||
| 14 | }, | ||
| 15 | drive_id => { | ||
| 16 | data_type => 'text', | ||
| 17 | is_nullable => 0, | ||
| 18 | }, | ||
| 19 | title => { | ||
| 20 | data_type => 'text', | ||
| 21 | is_nullable => 0, | ||
| 22 | }, | ||
| 23 | artist => { | ||
| 24 | data_type => 'text', | ||
| 25 | is_nullable => 1, | ||
| 26 | }, | ||
| 27 | album => { | ||
| 28 | data_type => 'text', | ||
| 29 | is_nullable => 1, | ||
| 30 | }, | ||
| 31 | track_number => { | ||
| 32 | data_type => 'integer', | ||
| 33 | is_nullable => 1, | ||
| 34 | }, | ||
| 35 | year => { | ||
| 36 | data_type => 'integer', | ||
| 37 | is_nullable => 1, | ||
| 38 | }, | ||
| 39 | duration_ms => { | ||
| 40 | data_type => 'integer', | ||
| 41 | is_nullable => 1, | ||
| 42 | }, | ||
| 43 | size => { | ||
| 44 | data_type => 'integer', | ||
| 45 | is_nullable => 1, | ||
| 46 | }, | ||
| 47 | mime_type => { | ||
| 48 | data_type => 'text', | ||
| 49 | is_nullable => 0, | ||
| 50 | }, | ||
| 51 | modified_time => { | ||
| 52 | data_type => 'text', | ||
| 53 | is_nullable => 1, | ||
| 54 | }, | ||
| 55 | folder_id => { | ||
| 56 | data_type => 'integer', | ||
| 57 | is_nullable => 1, | ||
| 58 | is_foreign_key => 1, | ||
| 59 | }, | ||
| 60 | folder_path => { | ||
| 61 | data_type => 'text', | ||
| 62 | is_nullable => 1, | ||
| 63 | }, | ||
| 64 | genre => { | ||
| 65 | data_type => 'text', | ||
| 66 | is_nullable => 1, | ||
| 67 | }, | ||
| 68 | comment => { | ||
| 69 | data_type => 'text', | ||
| 70 | is_nullable => 1, | ||
| 71 | }, | ||
| 72 | metadata_fetched => { | ||
| 73 | data_type => 'integer', | ||
| 74 | is_nullable => 0, | ||
| 75 | default_value => 0, | ||
| 76 | }, | ||
| 77 | ); | ||
| 78 | |||
| 79 | 2 | __PACKAGE__->set_primary_key('id'); | |
| 80 | 2 | __PACKAGE__->add_unique_constraint( unique_drive_id => ['drive_id'] ); | |
| 81 | |||
| 82 | 2 | __PACKAGE__->belongs_to( | |
| 83 | folder => 'App::DrivePlayer::Schema::Result::Folder', | ||
| 84 | 'folder_id', | ||
| 85 | ); | ||
| 86 | |||
| 87 | 35 | ▶ | sub sqlt_deploy_hook { |
|
Subroutine
sqlt_deploy_hook: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 88 | 35 | my ($self, $sqlt_table) = @_; | |
| 89 | 35 | $sqlt_table->add_index( name => 'idx_tracks_artist', fields => ['artist'] ); | |
| 90 | 35 | $sqlt_table->add_index( name => 'idx_tracks_album', fields => ['album'] ); | |
| 91 | 35 | $sqlt_table->add_index( name => 'idx_tracks_folder', fields => ['folder_id'] ); | |
| 92 | 35 | $sqlt_table->add_index( name => 'idx_tracks_title', fields => ['title'] ); | |
| 93 | } | ||
| 94 | |||
| 95 | 2 | 1; | |
| 96 | |||
| 97 | __END__ | ||