init commit,
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
-- Create a table called "todos"
|
||||
-- with a column to store tasks.
|
||||
BEGIN;
|
||||
DROP TABLE IF EXISTS "todos";
|
||||
CREATE TABLE todos(
|
||||
id serial PRIMARY KEY,
|
||||
task text
|
||||
);
|
||||
|
||||
-- Turn on security
|
||||
ALTER TABLE "todos" ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
-- Allow anonymous access
|
||||
CREATE POLICY "Allow public access" ON todos
|
||||
FOR SELECT TO anon
|
||||
USING (TRUE);
|
||||
|
||||
-- Turn on security
|
||||
ALTER TABLE "todos" ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
-- Add some data
|
||||
INSERT INTO todos(task)
|
||||
VALUES
|
||||
('Create tables'),
|
||||
('Enable security'),
|
||||
('Add data'),
|
||||
('Fetch data from the API');
|
||||
COMMIT;
|
||||
|
Reference in New Issue
Block a user