DBIx-Class-Sims

 view release on metacpan or  search on metacpan

t/regressions/preferences_table.t  view on Meta::CPAN

# vi:sw=2
use strictures 2;

use Test2::V0 qw(
  done_testing subtest E match is
  array hash field item end
);

use lib 't/lib';

use File::Path qw( remove_tree );
use YAML::Any qw( LoadFile );

# Needs the following where-clause in the has_many()
#   {
#     where          => { 'me.type' => 'artist' },
#     cascade_delete => 0,
#     cache_for      => 1,
#   }

BEGIN {
  use loader qw(build_schema);
  build_schema([
    Artist => {
      columns => {
        id => {
          data_type => 'int',
          is_nullable => 0,
          is_auto_increment => 1,
        },
        name => {
          data_type => 'varchar',
          size => 128,
          is_nullable => 0,
        },
      },
      primary_keys => [ 'id' ],
      has_many => {
        albums => { Album => 'artist_id' },
        preferences => { Preference => 'type_id' },
      },
    },
    Album => {
      columns => {
        id => {
          data_type => 'int',
          is_nullable => 0,
          is_auto_increment => 1,
        },
        artist_id => {
          data_type => 'int',
          is_nullable => 0,
        },
        name => {
          data_type => 'varchar',
          size => 128,
          is_nullable => 0,
        },
      },
      primary_keys => [ 'id' ],
      belongs_to => {
        artist => { Artist => 'artist_id' },
      },
      has_many => {
        preferences => { Preference => 'type_id' },
      },
    },
    Preference => {
      columns => {
        id => {
          data_type => 'int',
          is_nullable => 0,
          is_auto_increment => 1,
        },
        type => {
          data_type => 'varchar',
          size => 128,



( run in 1.382 second using v1.01-cache-2.11-cpan-63c85eba8c4 )