Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update telescope_profiles and feeds tables #2977

Merged

Conversation

DukeManh
Copy link
Contributor

@DukeManh DukeManh commented Feb 17, 2022

Issue This PR Addresses

Part of #2860

This updates feeds table schema in preparation for migrating Planet feed list to Supabase.

Schema

Field Description
url text - primary key - unique feed url
user_id text - optional foreign key - A register can claim an existing feed when they register for Telescope
author_name text - author name get from Planet, will be unused when the feed is linked with a user
html_url text optional - Actually blog URL of the RSS feed
type 'blog' | 'youtube' | 'twitch'
flagged boolean
Invalid boolean

Steps to test the PR

  1. Pick up the new schema script
     docker-compose stop db && docker-compose rm db
     docker-compose up db -d
    
  2. Rebuild the SSO service
     docker-compose build sso
    
  3. Start all services
     pnpm  dev
     pnpm services:start
    
  4. Register Telescope user at http://localhost:8000/signup
  5. If a feed entered is already associated with a user, registration should fail

@gitpod-io
Copy link

gitpod-io bot commented Feb 17, 2022

@DukeManh
Copy link
Contributor Author

@tcvan0707 This made a slight change to how a feed is considered to be invalid. A user can add an existing feed if it is not already linked with a Telescope user, or the user_id is null.

@DukeManh
Copy link
Contributor Author

@humphd and @JerryHue, I might miss some properties as suggested here #2860 (comment), let me know.

@TueeNguyen
Copy link
Contributor

@JerryHue said to change link to source or src_link. I don't think link is descriptive enough but for me it's fine

@JerryHue JerryHue added area: supabase Anything related to Supabase area: back-end labels Feb 18, 2022
@humphd
Copy link
Contributor

humphd commented Feb 18, 2022

html_url is probably better than link, such that url is a feed URL, and html_url is for HTML.

@DukeManh
Copy link
Contributor Author

html_url is probably better than link, such that url is a feed URL, and html_url is for HTML.

I changed link -> html_url

@cindyledev
Copy link
Contributor

cindyledev commented Feb 20, 2022

I noticed you initially created the telescope_profiles table without explicitly passing a schema which means Postgres creates the table in the public schema. Would this be a problem in the future?

From Supabase Tables docs

Tables belong to schemas. If you don't explicitly pass the schema, Postgres will assume that you want to create the table in the public schema.

@DukeManh
Copy link
Contributor Author

DukeManh commented Feb 21, 2022

@cindyledev, we want to put them public schema so they are exposed to the client.
When you write supabase.from('telescope_profiles').select('*'), supabase is going to look for the table in the public schema. There shouldn't be a problem if we have RLS to give/deny access to certain users.

@aserputov aserputov linked an issue Feb 22, 2022 that may be closed by this pull request
Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, a few small things.

docker/supabase/volumes/db/init/04-telescope-schema.sql Outdated Show resolved Hide resolved
docker/supabase/volumes/db/init/04-telescope-schema.sql Outdated Show resolved Hide resolved
@aserputov aserputov added this to the 2.8 Release milestone Feb 22, 2022
@DukeManh DukeManh changed the title Update planet feed schema Update telescope_profiles and feeds tables Feb 23, 2022
@Kevan-Y
Copy link
Contributor

Kevan-Y commented Feb 23, 2022

@DukeManh followed the steps. I'm getting this 🔽
image
image
I have the user stored in the database, but not for the feed.

@DukeManh
Copy link
Contributor Author

You'll need to run the frontend server with pnpm run dev, I've updated the instructions. Can you try again?

Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'm wrong about html url from wiki. Looks good

@DukeManh DukeManh merged commit aab709c into Seneca-CDOT:master Feb 23, 2022
@DukeManh
Copy link
Contributor Author

Thank you, everyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: back-end area: supabase Anything related to Supabase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate Planet Feed to Supabase db
7 participants