docs: Changes to readme after testing out supabase example#11
docs: Changes to readme after testing out supabase example#11
Conversation
|
|
||
| ```bash | ||
| npx supabase login | ||
| npx supabase init |
There was a problem hiding this comment.
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.
| # 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.
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.
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.
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.
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.