You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Type check failed in assignment to $!right; expected Red::AST but got Slip (Empty)
in method new at /opt/rakudo/share/perl6/site/sources/C9350343A71D40EA1AD797EAE41FF4033DE1D942 (Red::AST::Infix) line 25
in method relationship-ast at /opt/rakudo/share/perl6/site/sources/5B590052F4BF0EE76C3AD47F0924399022200F06 (Red::Attr::Relationship) line 115
in block at /opt/rakudo/share/perl6/site/sources/A7D03B9351A22E38BD993AFC9540FC31CB15D193 (MetamodelX::Red::Model) line 243
in method join-on at /opt/rakudo/share/perl6/site/sources/A7D03B9351A22E38BD993AFC9540FC31CB15D193 (MetamodelX::Red::Model) line 219
in block at /opt/rakudo/share/perl6/site/sources/0CE2BEE5D75F567587DF41AB96CF355DEE1C04B4 (Red::Driver::CommonSQL) line 372
in block at /opt/rakudo/share/perl6/site/sources/0CE2BEE5D75F567587DF41AB96CF355DEE1C04B4 (Red::Driver::CommonSQL) line 369
in method translate at /opt/rakudo/share/perl6/site/sources/0CE2BEE5D75F567587DF41AB96CF355DEE1C04B4 (Red::Driver::CommonSQL) line 355
in method prepare at /opt/rakudo/share/perl6/site/sources/0B9FDA4C1B7C1D06E6DC4ACC47C88D08C4AEF515 (Red::Driver) line 77
in submethod TWEAK at /opt/rakudo/share/perl6/site/sources/BE9C8AF8302236E807B04730E2C7B7243C17FE75 (Red::ResultSeq::Iterator) line 14
in method iterator at /opt/rakudo/share/perl6/site/sources/B9741F975EBBCC400F6E939A03452845E5AA24DD (Red::ResultSeq) line 89
in method Seq at /opt/rakudo/share/perl6/site/sources/B9741F975EBBCC400F6E939A03452845E5AA24DD (Red::ResultSeq) line 95
in method do-it at /opt/rakudo/share/perl6/site/sources/B9741F975EBBCC400F6E939A03452845E5AA24DD (Red::ResultSeq) line 100
in method head at /opt/rakudo/share/perl6/site/sources/B9741F975EBBCC400F6E939A03452845E5AA24DD (Red::ResultSeq) line 308
in method load at /opt/rakudo/share/perl6/site/sources/A7D03B9351A22E38BD993AFC9540FC31CB15D193 (MetamodelX::Red::Model) line 560
example.raku
use Red:api<2>;
model A is table {
has Int $.id is serial;
has Str $.name is column;
}
model B is table {
has Int $.a-id is column{ :id, :referencing(*.a-id, :model) };
has A $.a is relationship{ .a-id };
has Str $.name is column;
}
red-defaults default => database 'SQLite';
schema(A, B).create;
my $a = A.^create: :name('A');
B.^load: :a-id($a.id);
The text was updated successfully, but these errors were encountered:
As discussed on IRC, the code was wrong, right? @xinminglai would you mind posting the working code here, please?
Anyway, this error is at least LTA. I need to fix that. Thanks
Hi, This is modified version, Which works perfectly. So, We can safely close this bug, And I'll send a patch for cookbook
use Red:api<2>;
model B { ... }
model A is table<aa> {
has Int $.id is serial;
has Str $.name is column;
}
model B is table<bb> {
has Int $.a-id is column{ :id, :references{.id}, :model-name<A>, };
has A $.a is relationship{ .a-id };
has Str $.name is column;
}
red-defaults default => database 'SQLite';
schema(A, B).create;
my $a = A.^create: :name('A');
B.^create: :a-id($a.id), :name('b');
my $b = B.^load: :a-id($a.id);
$b.raku.say;
Below example code will raise error:
example.raku
use Red:api<2>;
model A is table {
has Int $.id is serial;
has Str $.name is column;
}
model B is table {
has Int $.a-id is column{ :id, :referencing(*.a-id, :model) };
has A $.a is relationship{ .a-id };
has Str $.name is column;
}
red-defaults default => database 'SQLite';
schema(A, B).create;
my $a = A.^create: :name('A');
B.^load: :a-id($a.id);
The text was updated successfully, but these errors were encountered: