# Pastebin gAVdZv4N $ perl6 -MRed -e ' model B is table { ... } model A is table { has UInt $.id is serial; has B @.bs is relationship{ .a-id } } model B { has UInt $.id is serial; has UInt $.a-id is referencing{ A.id }; has A $.a is relationship{ .a-id } } my $*RED-DB = database "SQLite"; A.^create-table; B.^create-table; my $a = A.^create; given $a { .bs.create; .bs.create; .bs.create } .say for $a.bs ' B.new(id => 1, a-id => 1, a => A.new(id => 1, bs => B::ResultSeq.new(chain => Red::AST::Chained.new(filter => Red::AST::Eq.new(op => "=", returns => Bool, left => Red::Column.new(attr => bbb.a_id, attr-name => "a-id", id => Bool::False, auto-increment => Bool::False, references => -> ;; $_? is raw { #`(Block|140374268263096) ... }, nullable => Bool::True, name => "a_id", name-alias => "a_id", type => Str, inflate => { ... }, deflate => { ... }, computation => Any, model-name => Str, column-name => Str, require => Str), right => Red::AST::Value.new(value => 1, column => Red::Column, type => Int), bind-left => Bool::False, bind-right => Bool::True), limit => Int, post => Callable, order => Array[Red::AST].new(), group => Array[Red::AST].new(), table-list => [], next => Red::AST::Chained), update => (my Red::AST %), comments => Array[Red::AST::Comment].new()))) B.new(id => 2, a-id => 1, a => A.new(id => 1, bs => B::ResultSeq.new(chain => Red::AST::Chained.new(filter => Red::AST::Eq.new(op => "=", returns => Bool, left => Red::Column.new(attr => bbb.a_id, attr-name => "a-id", id => Bool::False, auto-increment => Bool::False, references => -> ;; $_? is raw { #`(Block|140374268263096) ... }, nullable => Bool::True, name => "a_id", name-alias => "a_id", type => Str, inflate => { ... }, deflate => { ... }, computation => Any, model-name => Str, column-name => Str, require => Str), right => Red::AST::Value.new(value => 1, column => Red::Column, type => Int), bind-left => Bool::False, bind-right => Bool::True), limit => Int, post => Callable, order => Array[Red::AST].new(), group => Array[Red::AST].new(), table-list => [], next => Red::AST::Chained), update => (my Red::AST %), comments => Array[Red::AST::Comment].new()))) B.new(id => 3, a-id => 1, a => A.new(id => 1, bs => B::ResultSeq.new(chain => Red::AST::Chained.new(filter => Red::AST::Eq.new(op => "=", returns => Bool, left => Red::Column.new(attr => bbb.a_id, attr-name => "a-id", id => Bool::False, auto-increment => Bool::False, references => -> ;; $_? is raw { #`(Block|140374268263096) ... }, nullable => Bool::True, name => "a_id", name-alias => "a_id", type => Str, inflate => { ... }, deflate => { ... }, computation => Any, model-name => Str, column-name => Str, require => Str), right => Red::AST::Value.new(value => 1, column => Red::Column, type => Int), bind-left => Bool::False, bind-right => Bool::True), limit => Int, post => Callable, order => Array[Red::AST].new(), group => Array[Red::AST].new(), table-list => [], next => Red::AST::Chained), update => (my Red::AST %), comments => Array[Red::AST::Comment].new())))