-
Notifications
You must be signed in to change notification settings - Fork 1
docs: Changes to readme after testing out supabase example #11
base: main
Are you sure you want to change the base?
Conversation
@@ -60,7 +60,6 @@ First, let's set up a local development environment for the Supabase Twitter clo | |||
|
|||
```bash | |||
npx supabase login | |||
npx supabase init |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got this when I ran this:
failed to create config file: open supabase/config.toml: file exists
Try rerunning the command with --debug to troubleshoot the error.
I guess we don't need to init
anymore since we already checked in the stuff that was generated during init.
@@ -71,8 +70,7 @@ First, let's set up a local development environment for the Supabase Twitter clo | |||
# Your projectID can be found using the `supabase projects list` command and noting the REFERENCE ID value. | |||
# Input your remote database password when prompted. | |||
npx supabase link --project-ref <your-twitter-clone-project-id> | |||
# Create a valid migrations folder for Supabase to pull the first migration. | |||
mkdir -p supabase/migrations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, the dir already existed. I guess we could keep this around regardless (won't error or anything), but didn't seem needed anymore.
-- Publication for the tweets table to enable real-time functionality | ||
ALTER PUBLICATION "supabase_realtime" ADD TABLE "public"."tweets"; | ||
RESET ALL; | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were already in the migration file that was checked into the repo, so I guessed we don't need these lines in the readme anymore: https://github.com/snaplet/examples/blob/main/seed/supabase-twitter-clone/supabase/migrations/20240312180754_remote_schema.sql#L169-L171
`http://localhost:3000/api/auth/dev/login?email=<user-email>&password=<user-password>` | ||
|
||
However, we still need to create a new user with email and password. This is where Snaplet Seed will be utilized. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code was already in the repo:
So I guessed we don't need it in the readme still. Or did I misunderstand, and we want to still keep it around in the readme regardless?
await seed.$resetDatabase() | ||
|
||
// Generate 10 tweets with valid avatar URLs | ||
await seed.tweets(x => x(10)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running this script failed for me. The db relies on a users
metadata field being populated with the avatarUrl, name, user_name, so that the trigger can use these fields to create the corresponding profile: https://github.com/snaplet/examples/blob/main/seed/supabase-twitter-clone/supabase/migrations/20240312180754_remote_schema.sql#L41-L43
I tried create this metadata field, it worked but then the next error was that @snaplet/seed
tried automatically create a profile rows when creating these tweets, so we ended up with duplicate ids (since db created some of the ids via trigger, and @snaplet/seed
also did).
At this point though, I figured if the next thing we're doing is showing users a how to create the users+profiles using the supabase sdk, then using connect
to connect the profiles up to the tweets, then maybe we just show them that flow, and this first example where we create the tweets without the users isn't needed.
So I changed the readme accordingly.
I'm trying out the supabase example and finding some things while I do it. Creating a draft PR to adjust things as I go.