use Red; model User { has Int $!id is serial; has Str $.username is column is rw; has Str $.password is column is rw; has @.vmails is relationship(*.user_id, :model); } model Vmail { has Int $!id is serial; has Int $!user_id is referencing(*.id, :model); has Str $.name is column; has $.user is relationship(*.id, :model); } #### #!/usr/bin/raku use Red; use lib 'lib'; use Schema; my $*RED-DB = database "Pg", :user, :dbname, :password<--redacted-->; my $user = User.^create( username => 'Bill' ); print "*** DONE ***\n"; #### # \d user Table "public.user" Column | Type | Modifiers ----------+---------+--------------------------------------------------- id | integer | not null default nextval('user_id_seq'::regclass) username | text | password | text | Indexes: "user_pkey" PRIMARY KEY, btree (id) Referenced by: TABLE "vmail" CONSTRAINT "vmail_user_id_fkey" FOREIGN KEY (user_id) REFERENCES "user"(id) =# \d vmail Table "public.vmail" Column | Type | Modifiers ---------+---------+---------------------------------------------------- id | integer | not null default nextval('vmail_id_seq'::regclass) user_id | integer | name | text | Indexes: "vmail_pkey" PRIMARY KEY, btree (id) Foreign-key constraints: "vmail_user_id_fkey" FOREIGN KEY (user_id) REFERENCES "user"(id) #### Could not find Vmail in: file#/var/www/apps/raku/vmail/lib inst#/root/.raku inst#/opt/rakudo-pkg/share/perl6/site inst#/opt/rakudo-pkg/share/perl6/vendor inst#/opt/rakudo-pkg/share/perl6/core ap# nqp# perl5# in block at /opt/rakudo-pkg/share/perl6/site/sources/9740DDE0E85E093DCDF40F690C620BD9BAEE9078 (Red::Attr::Relationship) line 46 in method relationship-model at /opt/rakudo-pkg/share/perl6/site/sources/9740DDE0E85E093DCDF40F690C620BD9BAEE9078 (Red::Attr::Relationship) line 43 in method build-relationship at /opt/rakudo-pkg/share/perl6/site/sources/9740DDE0E85E093DCDF40F690C620BD9BAEE9078 (Red::Attr::Relationship) line 67 in method at /opt/rakudo-pkg/share/perl6/site/sources/C6C0BDEB2D9A3E5141D8CD425806A5162AFE5DE9 (MetamodelX::Red::Relationship) line 58 in method create at /opt/rakudo-pkg/share/perl6/site/sources/A963FC4C1C5D6923CAA0DC1451EE51EA254DA1ED (MetamodelX::Red::Model) line 483 in block at test_red.raku line 9