radio4000 / migrate-tool

A website for managing a Radio4000 channel migration, from firebase (realtime) to supabase
https://migrate.radio4000.com/
0 stars 0 forks source link

Update database schema #20

Closed oskarrough closed 3 years ago

oskarrough commented 3 years ago

Update sql/init.sql with the following.

All tables should have these fields

Tables to create

Junction tables to create

oskarrough commented 3 years ago

How about "cascades" e.g. deleting relationships automatically?

oskarrough commented 3 years ago

We've proposed replacing channel.user_id with the junction table user_channel. That would make these policies invalid.

How would we update them?

create policy "User can insert their own channel."
  on channels for insert
  with check ( auth.uid() = user_id );

maybe?

create policy "User can insert their own channel."
  on channels for insert
  using ( 
    auth.uid() in (
        select user_id from user_channel where user_channel.user_id = auth.uid()
    )
  );
oskarrough commented 3 years ago

track is missing discogs url