Skip to content

Instantly share code, notes, and snippets.

@FCO
Created April 2, 2022 12:14
Show Gist options
  • Save FCO/415e4de3ac20fbab7496a193af59a254 to your computer and use it in GitHub Desktop.
Save FCO/415e4de3ac20fbab7496a193af59a254 to your computer and use it in GitHub Desktop.
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