1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-01-31 14:28:04 +00:00
_/supabase/initdb.d/99-example.sql

14 lines
454 B
MySQL
Raw Normal View History

2021-10-14 18:45:42 +09:00
ALTER DEFAULT PRIVILEGES IN SCHEMA public REVOKE ALL PRIVILEGES ON TABLES FROM anon, authenticated;
CREATE TABLE users (
uuid UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
role NAME NOT NULL DEFAULT current_user,
name TEXT
);
GRANT ALL PRIVILEGES (name) ON users TO authenticated;
GRANT SELECT ON users TO anon, authenticated;
ALTER TABLE users ENABLE ROW LEVEL SECURITY;
CREATE POLICY users_policy ON users USING (role = current_user);