| 1 | package DBIO::ClickHouse::Test::Schema::Probe; | ||
| 2 | # ABSTRACT: Test result class -- one column per branch of the DDL type map | ||
| 3 | |||
| 4 | 24 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 24 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 24 | our $VERSION = '0.900007'; | |
| 8 | |||
| 9 | 24 | ▶ | use base 'DBIO::Core'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | |||
| 12 | 24 | __PACKAGE__->table('dbio_test_probe'); | |
| 13 | |||
| 14 | 24 | __PACKAGE__->add_columns( | |
| 15 | # the key | ||
| 16 | id => { data_type => 'integer', is_nullable => 0 }, | ||
| 17 | |||
| 18 | # integers, by width, signed and unsigned | ||
| 19 | i8 => { data_type => 'tinyint', is_nullable => 0 }, | ||
| 20 | i16 => { data_type => 'smallint', is_nullable => 0 }, | ||
| 21 | i64 => { data_type => 'bigint', is_nullable => 0 }, | ||
| 22 | u32 => { data_type => 'integer', extra => { unsigned => 1 }, is_nullable => 0 }, | ||
| 23 | u64 => { data_type => 'bigint', extra => { unsigned => 1 }, is_nullable => 0 }, | ||
| 24 | |||
| 25 | # floats and fixed point | ||
| 26 | f32 => { data_type => 'real', is_nullable => 0 }, | ||
| 27 | f64 => { data_type => 'double precision', is_nullable => 0 }, | ||
| 28 | dec => { data_type => 'decimal', size => [10, 2], is_nullable => 0 }, | ||
| 29 | amount => { data_type => 'money', is_nullable => 0 }, | ||
| 30 | |||
| 31 | # the string family, all of which collapse onto String | ||
| 32 | s_var => { data_type => 'varchar', size => 255, is_nullable => 0 }, | ||
| 33 | s_text => { data_type => 'text', is_nullable => 0 }, | ||
| 34 | s_blob => { data_type => 'blob', is_nullable => 0 }, | ||
| 35 | s_json => { data_type => 'json', is_nullable => 0 }, | ||
| 36 | |||
| 37 | # the two opt-in string encodings | ||
| 38 | s_fixed => { data_type => 'char', size => 3, is_nullable => 0, | ||
| 39 | extra => { fixed_string => 1 } }, | ||
| 40 | s_low => { data_type => 'varchar', size => 32, is_nullable => 0, | ||
| 41 | extra => { low_cardinality => 1 } }, | ||
| 42 | |||
| 43 | # LowCardinality nests OUTSIDE Nullable | ||
| 44 | s_low_null => { data_type => 'varchar', size => 32, is_nullable => 1, | ||
| 45 | extra => { low_cardinality => 1 } }, | ||
| 46 | |||
| 47 | # misc scalars | ||
| 48 | flag => { data_type => 'boolean', is_nullable => 0 }, | ||
| 49 | guid => { data_type => 'uuid', is_nullable => 0 }, | ||
| 50 | ip => { data_type => 'IPv4', is_nullable => 0 }, | ||
| 51 | |||
| 52 | # temporal: portable spelling vs exact native spelling | ||
| 53 | d_wide => { data_type => 'date', is_nullable => 0 }, | ||
| 54 | d_narrow => { data_type => 'Date', is_nullable => 0 }, | ||
| 55 | ts_ms => { data_type => 'datetime', is_nullable => 0 }, | ||
| 56 | ts_sec => { data_type => 'DateTime', is_nullable => 0 }, | ||
| 57 | ts_utc => { data_type => 'timestamptz', is_nullable => 0 }, | ||
| 58 | t_str => { data_type => 'time', is_nullable => 0 }, | ||
| 59 | |||
| 60 | # enum, with a member that needs escaping | ||
| 61 | state => { data_type => 'enum', is_nullable => 0, | ||
| 62 | extra => { list => ['draft', 'live', q{it's}] } }, | ||
| 63 | |||
| 64 | # arrays are never wrapped in Nullable() | ||
| 65 | tags => { data_type => 'text[]', is_nullable => 1 }, | ||
| 66 | nums => { data_type => 'integer[]', is_nullable => 0 }, | ||
| 67 | |||
| 68 | # nullability and the two default shapes | ||
| 69 | note => { data_type => 'varchar', size => 64, is_nullable => 1 }, | ||
| 70 | title => { data_type => 'varchar', size => 64, is_nullable => 0, | ||
| 71 | default_value => 'untitled' }, | ||
| 72 | counter => { data_type => 'bigint', is_nullable => 0, default_value => \'0' } | ||
| 73 | ); | ||
| 74 | |||
| 75 | 24 | __PACKAGE__->set_primary_key('id'); | |
| 76 | |||
| 77 | 24 | 1; | |
| 78 | |||
| 79 | __END__ | ||