# Pastebin DbaNT9NP diff --git a/examples/case-study-1/load-db.p6 b/examples/case-study-1/load-db.p6 index 8251b92..73a1a63 100755 --- a/examples/case-study-1/load-db.p6 +++ b/examples/case-study-1/load-db.p6 @@ -5,70 +5,10 @@ use Red; use lib <./lib>; use OurFuncs; -=begin comment -# do not know how to 'use' these yet: -#model Person {...} use Present; use Attend; use Email; use Person; -=end comment - -#===================================================================== -# TODO Successfully split the following models into a lib directory as -# individual packages and 'use' them in this script and the -# 'query-db.p6' and 'update-db.p6' scripts. -#===================================================================== - -model Person {...} - -model Email is rw { - # relationship - has UInt $!person-id is referencing{:column, :model}; - has Person $.person is relationship{:column, :model}; - - # data: - has Str $.email is column; - has Str $.notes is column{:nullable}; - has UInt $.status is column{:nullable}; -} - -model Present is rw { - # relationship - has UInt $!person-id is referencing{:column, :model}; - has Person $.person is relationship{:column, :model}; - - # data: - has UInt $.year is column; - has Str $.notes is column{:nullable}; -} - -model Attend is rw { - # relationship - has UInt $!person-id is referencing{:column, :model}; - has Person $.person is relationship{:column, :model}; - - # data: - has UInt $.year is column; - has Str $.notes is column{:nullable}; -} - -model Person is rw { - # note the following is for user-defined keys - has Str $.key is id; - - # data: - has Str $.last is column; - has Str $.first is column; - has Str $.notes is column{:nullable}; - - # relations - has Attend @.attends is relationship({.person-id }, :model); - has Email @.emails is relationship({.person-id }, :model); - has Present @.presents is relationship({.person-id }, :model); -} -#========================================================== - my $f = './data/attendees.csv'; my $dbf = './data/ctech.sqlite';