| 1 | package XAS::Model::Database::Messaging::Result::Alert; | ||
| 2 | |||
| 3 | our $VERSION = '0.01'; | ||
| 4 | |||
| 5 | use XAS::Class | ||
| 6 | 0 | ▶ | version => $VERSION, |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 7 | base => 'DBIx::Class::Core', | ||
| 8 | mixin => 'XAS::Model::DBM' | ||
| 9 | 1 | ; | |
| 10 | |||
| 11 | __PACKAGE__->load_components( qw/ InflateColumn::DateTime OptimisticLocking / ); | ||
| 12 | __PACKAGE__->table( 'alert' ); | ||
| 13 | __PACKAGE__->add_columns( | ||
| 14 | id => { | ||
| 15 | data_type => 'bigint', | ||
| 16 | is_auto_increment => 1, | ||
| 17 | sequence => 'alert_id_seq', | ||
| 18 | is_nullable => 0 | ||
| 19 | }, | ||
| 20 | hostname => { | ||
| 21 | data_type => 'varchar', | ||
| 22 | size => 254, | ||
| 23 | is_nullable => 0 | ||
| 24 | }, | ||
| 25 | datetime => { | ||
| 26 | data_type => 'timestamp with time zone', | ||
| 27 | timezone => 'local', | ||
| 28 | is_nullable => 0 | ||
| 29 | }, | ||
| 30 | level => { | ||
| 31 | data_type => 'varchar', | ||
| 32 | size => 32, | ||
| 33 | is_nullable => 0 | ||
| 34 | }, | ||
| 35 | facility => { | ||
| 36 | data_type => 'varchar', | ||
| 37 | size => 32, | ||
| 38 | is_nullable => 0 | ||
| 39 | }, | ||
| 40 | process => { | ||
| 41 | data_type => 'varchar', | ||
| 42 | size => 32, | ||
| 43 | is_nullable => 0 | ||
| 44 | }, | ||
| 45 | message => { | ||
| 46 | data_type => 'varchar', | ||
| 47 | size => 256, | ||
| 48 | is_nullable => 0 | ||
| 49 | }, | ||
| 50 | pid => { | ||
| 51 | data_type => 'varchar', | ||
| 52 | size => 16, | ||
| 53 | is_nullable => 0 | ||
| 54 | }, | ||
| 55 | tid => { | ||
| 56 | data_type => 'varchar', | ||
| 57 | size => 32, | ||
| 58 | is_nullable => 0 | ||
| 59 | }, | ||
| 60 | msgnum => { | ||
| 61 | data_type => 'varchar', | ||
| 62 | size => 16, | ||
| 63 | is_nullable => 0 | ||
| 64 | }, | ||
| 65 | cleared => { | ||
| 66 | data_type => 'boolean', | ||
| 67 | default_value => 'f', | ||
| 68 | is_nullable => 0 | ||
| 69 | }, | ||
| 70 | cleartime => { | ||
| 71 | data_type => 'timestamp with time zone', | ||
| 72 | timezone => 'local', | ||
| 73 | is_nullable => 1 | ||
| 74 | }, | ||
| 75 | revision => { | ||
| 76 | data_type => 'integer', | ||
| 77 | is_nullable => 1 | ||
| 78 | } | ||
| 79 | ); | ||
| 80 | |||
| 81 | __PACKAGE__->set_primary_key( 'id' ); | ||
| 82 | __PACKAGE__->optimistic_locking_strategy('version'); | ||
| 83 | __PACKAGE__->optimistic_locking_version_column('revision'); | ||
| 84 | |||
| 85 | sub sqlt_deploy_hook { | ||
| 86 | my ($self, $sqlt_table) = @_; | ||
| 87 | |||
| 88 | } | ||
| 89 | |||
| 90 | sub table_name { | ||
| 91 | return __PACKAGE__; | ||
| 92 | } | ||
| 93 | |||
| 94 | 1; | ||
| 95 | |||
| 96 | __END__ | ||
| 97 | |||
| 98 | =head1 NAME | ||
| 99 | |||
| 100 | XAS::Model::Database::Messaging::Result::Alert - A Table for XAS Model | ||
| 101 | |||
| 102 | =head1 DESCRIPTION | ||
| 103 | |||
| 104 | The definition for the log table. | ||
| 105 | |||
| 106 | =head1 FIELDS | ||
| 107 | |||
| 108 | =head2 id | ||
| 109 | |||
| 110 | An automatic incremental index. | ||
| 111 | |||
| 112 | =over 4 | ||
| 113 | |||
| 114 | =item B<data type> - bigint | ||
| 115 | |||
| 116 | =item B<is nullable> - no | ||
| 117 | |||
| 118 | =back | ||
| 119 | |||
| 120 | =head2 hostname | ||
| 121 | |||
| 122 | The name of the host that the entry is from. | ||
| 123 | |||
| 124 | =over 4 | ||
| 125 | |||
| 126 | =item B<data type> - varchar | ||
| 127 | |||
| 128 | =item B<size> - 254 | ||
| 129 | |||
| 130 | =item B<is nullable> - no | ||
| 131 | |||
| 132 | =back | ||
| 133 | |||
| 134 | =head2 datetime | ||
| 135 | |||
| 136 | The date and time when the record was created. | ||
| 137 | |||
| 138 | =over 4 | ||
| 139 | |||
| 140 | =item B<data type> - timestamp with time zone | ||
| 141 | |||
| 142 | =item B<timezone> - local | ||
| 143 | |||
| 144 | =item B<is nullable> - no | ||
| 145 | |||
| 146 | =back | ||
| 147 | |||
| 148 | =head2 level | ||
| 149 | |||
| 150 | The level of the alert. | ||
| 151 | |||
| 152 | =over 4 | ||
| 153 | |||
| 154 | =item B<data type> - varchar | ||
| 155 | |||
| 156 | =item B<size> - 32 | ||
| 157 | |||
| 158 | =item B<is nullable> - no | ||
| 159 | |||
| 160 | =back | ||
| 161 | |||
| 162 | =head2 facility | ||
| 163 | |||
| 164 | The facility of the alert. | ||
| 165 | |||
| 166 | =over 4 | ||
| 167 | |||
| 168 | =item B<data type> - varchar | ||
| 169 | |||
| 170 | =item B<size> - 32 | ||
| 171 | |||
| 172 | =item B<is nullable> - no | ||
| 173 | |||
| 174 | =back | ||
| 175 | |||
| 176 | =head2 process | ||
| 177 | |||
| 178 | The name of the process that generated the alert. | ||
| 179 | |||
| 180 | =over 4 | ||
| 181 | |||
| 182 | =item B<data type> - varchar | ||
| 183 | |||
| 184 | =item B<size> - 32 | ||
| 185 | |||
| 186 | =item B<is nullable> - no | ||
| 187 | |||
| 188 | =back | ||
| 189 | |||
| 190 | =head2 message | ||
| 191 | |||
| 192 | The message. | ||
| 193 | |||
| 194 | =over 4 | ||
| 195 | |||
| 196 | =item B<data type> - varchar | ||
| 197 | |||
| 198 | =item B<size> - 256 | ||
| 199 | |||
| 200 | =item B<is nullable> - no | ||
| 201 | |||
| 202 | =back | ||
| 203 | |||
| 204 | =head2 pid | ||
| 205 | |||
| 206 | The process id of process that generated the alert. | ||
| 207 | |||
| 208 | =over 4 | ||
| 209 | |||
| 210 | =item B<data type> - varchar | ||
| 211 | |||
| 212 | =item B<size> - 16 | ||
| 213 | |||
| 214 | =item B<is nullable> - no | ||
| 215 | |||
| 216 | =back | ||
| 217 | |||
| 218 | =head2 tid | ||
| 219 | |||
| 220 | The id for the thread of the process that generated the alert. | ||
| 221 | |||
| 222 | =over 4 | ||
| 223 | |||
| 224 | =item B<data type> - varchar | ||
| 225 | |||
| 226 | =item B<size> - 32 | ||
| 227 | |||
| 228 | =item B<is nullable> - no | ||
| 229 | |||
| 230 | =back | ||
| 231 | |||
| 232 | =head2 msgnum | ||
| 233 | |||
| 234 | The message number of the message for the alert. | ||
| 235 | |||
| 236 | =over 4 | ||
| 237 | |||
| 238 | =item B<data type> - varchar | ||
| 239 | |||
| 240 | =item B<size> - 16 | ||
| 241 | |||
| 242 | =item B<is nullable> - no | ||
| 243 | |||
| 244 | =back | ||
| 245 | |||
| 246 | =head2 cleared | ||
| 247 | |||
| 248 | Wither the alert has been cleared. | ||
| 249 | |||
| 250 | =over 4 | ||
| 251 | |||
| 252 | =item B<data type> - boolean | ||
| 253 | |||
| 254 | =item B<default value> - false | ||
| 255 | |||
| 256 | =item B<is nullable> - yes | ||
| 257 | |||
| 258 | =back | ||
| 259 | |||
| 260 | =head2 cleartime | ||
| 261 | |||
| 262 | The date and time that it was cleared. | ||
| 263 | |||
| 264 | =over 4 | ||
| 265 | |||
| 266 | =item B<data type> - timestamp with time zone | ||
| 267 | |||
| 268 | =item B<timezone> - local | ||
| 269 | |||
| 270 | =item B<is nullable> - yes | ||
| 271 | |||
| 272 | =back | ||
| 273 | |||
| 274 | =head2 revision | ||
| 275 | |||
| 276 | Used by L<DBIx::Class::OptimisticLocking|https://metacpan.org/pod/DBIx::Class::Optimisticlocking> | ||
| 277 | to manage changes for this record. | ||
| 278 | |||
| 279 | =over 4 | ||
| 280 | |||
| 281 | =item B<data type> - integer | ||
| 282 | |||
| 283 | =item B<is nullable> - yes | ||
| 284 | |||
| 285 | =back | ||
| 286 | |||
| 287 | =head1 METHODS | ||
| 288 | |||
| 289 | =head2 sqlt_deploy_hook($sqlt_table) | ||
| 290 | |||
| 291 | This method is used when a database schema is being generated. It can be used | ||
| 292 | to add additional features. | ||
| 293 | |||
| 294 | =over 4 | ||
| 295 | |||
| 296 | =item B<$sqlt_table> | ||
| 297 | |||
| 298 | The DBIx::Class class for this table. | ||
| 299 | |||
| 300 | =back | ||
| 301 | |||
| 302 | =head2 table_name | ||
| 303 | |||
| 304 | Used by the helper functions mixed in from L<XAS::Model::DBM|XAS::Model::DBM>. | ||
| 305 | |||
| 306 | =head1 SEE ALSO | ||
| 307 | |||
| 308 | =over 4 | ||
| 309 | |||
| 310 | =item L<XAS::Collector|XAS::Collector> | ||
| 311 | |||
| 312 | =item L<XAS|XAS> | ||
| 313 | |||
| 314 | =back | ||
| 315 | |||
| 316 | =head1 AUTHOR | ||
| 317 | |||
| 318 | Kevin L. Esteb, E<lt>kevin@kesteb.usE<gt> | ||
| 319 | |||
| 320 | =head1 COPYRIGHT AND LICENSE | ||
| 321 | |||
| 322 | Copyright (c) 2015 Kevin L. Esteb | ||
| 323 | |||
| 324 | This is free software; you can redistribute it and/or modify it under | ||
| 325 | the terms of the Artistic License 2.0. For details, see the full text | ||
| 326 | of the license at http://www.perlfoundation.org/artistic_license_2_0. | ||
| 327 | |||
| 328 | =cut | ||