-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve feedback system so people can provide their email and we stor…
…e a record of it in our database add migration for feedback table
- Loading branch information
Showing
8 changed files
with
199 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
18.12.1 | ||
18.17.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
-- We use this to store feedback from our users | ||
CREATE TABLE IF NOT EXISTS public.feedback ( | ||
id SERIAL PRIMARY KEY, | ||
email VARCHAR(255), | ||
feedback_text TEXT NOT NULL, | ||
route TEXT NOT NULL, | ||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP | ||
); | ||
|
||
-- Grant permissions on public.feedback | ||
ALTER TABLE IF EXISTS public.feedback OWNER TO postgres; | ||
GRANT ALL ON TABLE public.feedback TO anon; | ||
GRANT ALL ON TABLE public.feedback TO authenticated; | ||
GRANT ALL ON TABLE public.feedback TO service_role; | ||
GRANT ALL ON TABLE public.feedback TO postgres; | ||
|
||
GRANT SELECT ON TABLE public.feedback TO toiletmap_web; | ||
GRANT INSERT ON TABLE public.feedback TO toiletmap_web; | ||
GRANT USAGE, SELECT ON SEQUENCE public.feedback_id_seq TO toiletmap_web; | ||
|
||
-- Setup row-level security on public.feedback | ||
ALTER TABLE public.feedback enable row level security; | ||
|
||
CREATE POLICY select_policy ON public.feedback | ||
FOR SELECT | ||
TO toiletmap_web | ||
USING (true); | ||
|
||
-- Allow only inserts | ||
CREATE POLICY insert_policy ON public.feedback | ||
FOR INSERT | ||
TO toiletmap_web | ||
WITH CHECK (true); -- Allows all inserts |