Database Tables Setup
Set up the required database tables and policies for Launchtoday’s profile and feedback features
Launchtoday comes with pre-built profile and feedback screens that require specific database tables and security policies to function. This guide provides the necessary SQL setup that powers these features:
- The profiles table that drives the Profile screen, including user avatars and profile information
- The feedback table that enables the Feedback submission screen
- An avatars storage bucket for profile images
- Security policies to protect user data
Quick Setup
For a quick setup, you can run the complete SQL script below in your Supabase SQL editor (the URL should look like this: https://supabase.com/project/*your-project-id*/sql/new
):
Step-by-Step Setup Guide
1. Profiles Table
First, let’s set up the profiles table that stores user information:
What this does:
- Creates a profiles table linked to auth.users
- Enables row-level security
- Sets up policies for viewing, creating, and updating profiles
2. Automatic Profile Creation
Set up automatic profile creation when users sign up:
What this does:
- Creates a trigger function that runs when new users sign up
- Automatically creates profile entries for new users
3. Feedback Table
Next, set up the feedback system:
What this does:
- Creates a feedback table for user submissions
- Enables row-level security
- Sets up policies so users can only view and create their own feedback
4. Avatar Storage
Finally, set up the storage system for profile pictures:
What this does:
- Creates a storage bucket for avatars
- Sets up policies for reading, uploading, updating, and deleting avatars
Verifying the Setup
After running the scripts, verify your setup by testing the app:
-
Start the app using either:
yarn ios-simulator
for iOSyarn android
for Android
-
Log into the app and verify the following:
-
Navigate to the Profile screen and test that you can:
- Upload a profile picture
- Set your username
- Add a website URL
- Write a bio
-
Go to the Feedback screen and verify you can:
- Submit a feature request
- Report a bug
-
-
Check your Supabase dashboard to confirm:
- New entries appear in the profiles table
- Feedback submissions show up in the feedback table
- Profile images are stored in the avatars storage bucket
If you encounter any issues, check the app logs and Supabase dashboard for error messages.