This repository has been archived by the owner on Sep 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
docs: Changes to readme after testing out supabase example #11
Draft
justinvdm
wants to merge
8
commits into
main
Choose a base branch
from
justin/tweaks-to-supabase-example-readme
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3ff7b09
Remove init
justinvdm be90964
rm mkdirp
justinvdm fcc9ff6
rm migration
justinvdm 48348d7
Rm user login code section
justinvdm 8f8bc4f
Typo
justinvdm 607b5b7
Fix syntax error
justinvdm 80913da
Base on what worked locally
justinvdm 2ac5352
main-ify
justinvdm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -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 | ||
``` | ||
|
||
![supabase-init-asciinema](https://github.com/snaplet/examples/assets/8771783/10f11bca-5dd5-42ac-b81a-b33d6016026e) | ||
|
@@ -71,23 +70,11 @@ 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 commentThe 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. |
||
|
||
# Pull the database schema from the remote project. | ||
npx supabase db pull | ||
``` | ||
|
||
This process creates a new `remote_schema.sql` file within the `supabase/migrations` folder. However, this migration lacks the necessary triggers and publications for our real-time updates to function correctly. Thus, we need to manually add them to the `remote_schema.sql` file: | ||
|
||
```sql | ||
-- Append at the end | ||
-- Trigger to create a profile for a user upon creation | ||
CREATE TRIGGER on_auth_user_created AFTER INSERT ON auth.users FOR EACH ROW EXECUTE FUNCTION "public"."create_profile_for_user"(); | ||
-- 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 commentThe 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 |
||
|
||
Next, we must synchronize our local development project with the remote one: | ||
|
||
```bash | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
I guess we don't need to
init
anymore since we already checked in the stuff that was generated during init.