{"body":"#`{{{\ncreate table person (\n\t   id    integer serial,\n\t   key   varchar(255) unique not null,\n\t   last  varchar(255) not null,\n\t   first varchar(255) not null\n\t   notes varchar(255)\n\t);\n}}}\n\t\nmodel Person {\n    has UInt $!id    is serial;\n    has Str  $.key   is column{ :unique };\n    has Str  $.last  is column;\n    has Str  $.first is column;\n    has Str  $.notes is column{ :nullable };\n    \n    has @.email    is relationship{ *.person-key, :model<Email> }\n    has @.attends  is relationship{ *.person-key, :model<Attend> }\n    has @.presents is relationship{ *.person-key, :model<Presents> }\n}\n\n#`{{{\t\n\tcreate table attend (\n\t   person_key varchar(255) not null,\n\t   year       integer not null,\n\t   notes      varchar(255),\n\t   UNIQUE     (person_key, year)\n\t);\n}}}\n\nmodel Attend {\n    has UInt $!id         is serial;\n    has UInt $!person-key is referencing{ :model<Person>, :column<id> };\n    has UInt $.year  is column;\n    has Str  $.notes is column;\n    ::?CLASS.^add-unique-counsraint: { .person-key, .year };\n        \n    has $.owner is relationship{ { .person-key }, :model<Person> }\n}\n\t\n#`{{{\n\tcreate table present (\n\t   person_key varchar(255) not null,\n\t   year       integer not null,\n\t   notes      varchar(255),\n\t   UNIQUE     (person_key, year)\n\t);\n}}}\n\nmodel Present {\n    has UInt $!id         is serial;\n    has UInt $!person-key is referencing{ :model<Person>, :column<id> };\n    has UInt $.year  is column;\n    has Str  $.notes is column;\n    ::?CLASS.^add-unique-counsraint: { .person-key, .year };\n        \n    has $.owner is relationship{ { .person-key }, :model<Person> }\n}\n\n#`{{{\t\n\tcreate table email (\n\t   person_key varchar(255) not null,\n\t   email      varchar(255) not null,\n\t   notes      varchar(255),\n\t   status     integer,\n\t   UNIQUE     (person_key, email)\n\t);\n}}}\n\nmodel Email {\n    has Str  $email       is id;\n    has UInt $!person-key is referencing{ :model<Person>, :column<id> };\n    has Str  $.notes is column;\n    ::?CLASS.^add-unique-counsraint: { .person-key, .year };\n    \n    has $.owner is relationship{ { .person-key }, :model<Person> }\n}","name":"","extension":"txt","url":"https://www.irccloud.com/pastebin/UGwTrDBo","modified":1553092791,"id":"UGwTrDBo","size":2095,"lines":78,"own_paste":false,"theme":"","date":1553092791}