Skip to content

Instantly share code, notes, and snippets.

@FCO
Created Apr 2, 2022
Embed
What would you like to do?
model User {
has Int $.id is serial;
has Str $.name is column;
has Str $.role is column;
}
red-defaults "SQLite";
schema(User).drop;
User.^create-table;
for <user admin root> -> $role { User.^create(:name("user " ~ ++$), :$role) }
submodel Admin of User where *.role eq "admin";
say User.new(:a<admin>) ~~ User;
Admin.^create: :name("new admin");
.say for Admin.^all;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment