hunk.code_window:           columns:
             - completed
             filter:
               user_id:
                 _eq: X-HASURA-USER-ID
           role: user
  
hunk.labels: keep keep keep keep keep replace replace
hunk.after_edit:       delete_permissions:
         - role: user
           comment: 
           permission:
             filter:
               user_id:
                 _eq: X-HASURA-USER-ID
         event_triggers: []
  
hunk.file_path: community/sample-apps/todo-auth0-jwt/hasura/migrations/1536761653464_init.up.yaml
hunk.type: replace
file: --
  -- SQL edited by https://hasura-edit-pg-dump.now.sh
  --
  
  COMMENT ON SCHEMA public IS 'standard public schema';
  
  CREATE TABLE public.todos (
      id integer NOT NULL,
      title text NOT NULL,
      is_completed boolean DEFAULT false NOT NULL,
      created_at timestamp with time zone DEFAULT now() NOT NULL,
      is_public boolean DEFAULT false NOT NULL,
      user_id text NOT NULL
  );
  
  CREATE TABLE public.users (
      id text NOT NULL,
      name text NOT NULL,
      created_at timestamp with time zone DEFAULT now() NOT NULL,
      last_seen timestamp with time zone
  );
  
  CREATE VIEW public.online_users AS
   SELECT users.id,
      users.last_seen
     FROM public.users
    WHERE (users.last_seen >= (now() - '00:00:30'::interval));
  
  CREATE SEQUENCE public.todos_id_seq
      AS integer
      START WITH 1
      INCREMENT BY 1
      NO MINVALUE
      NO MAXVALUE
      CACHE 1;
  
  ALTER SEQUENCE public.todos_id_seq OWNED BY public.todos.id;
  
  ALTER TABLE ONLY public.todos ALTER COLUMN id SET DEFAULT nextval('public.todos_id_seq'::regclass);
  
  ALTER TABLE ONLY public.todos
      ADD CONSTRAINT todos_pkey PRIMARY KEY (id);
  
  ALTER TABLE ONLY public.users
      ADD CONSTRAINT users_pkey PRIMARY KEY (id);
  
  ALTER TABLE ONLY public.todos
      ADD CONSTRAINT todos_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON UPDATE CASCADE ON DELETE CASCADE;
  
  