Skip to content

Latest commit

 

History

History
49 lines (40 loc) · 1.26 KB

File metadata and controls

49 lines (40 loc) · 1.26 KB

Supabase 初始化

初始化sql

create table public.mermaid (
    id integer generated by default as identity not null,
    name character varying not null,
    code text not null,
    created_at timestamp with time zone not null default now(),
    updated_at timestamp without time zone null default now(),
    constraint mermaid_pkey primary key (id)
) TABLESPACE pg_default;

-- Turn on security
alter table "mermaid"
enable row level security;

-- Allow anonymous access
create policy "Allow public access"
    on mermaid
    for select
    to anon
    using (true);

CREATE POLICY "Allow public insert"
    ON mermaid
    FOR INSERT
    TO anon
    WITH CHECK (true);

CREATE POLICY "Allow public update"
    ON mermaid
    FOR UPDATE
    TO anon
    USING (true)        -- 允许查看/修改哪些行
    WITH CHECK (true);  -- 允许修改成什么值

CREATE POLICY "Allow public delete"
    ON mermaid
    FOR DELETE
    TO anon
    USING (true);

获取 key 和访问域名

进入 supabase 项目,在左侧菜单栏选择 Project Settings,在打开的页面中选择 Data API 子菜单,在打开页面中拷贝默认展示的 URL 即可得到访问域名。

切换到 API Keys 子菜单,拷贝 anno public 值即可得到我们需要的 key。