merge: Merged fix/fave-migration to master #51
@@ -27,15 +27,3 @@ CREATE TRIGGER users_handle_new_user
|
|||||||
AFTER INSERT ON auth.users
|
AFTER INSERT ON auth.users
|
||||||
FOR EACH ROW EXECUTE FUNCTION handle_new_user();
|
FOR EACH ROW EXECUTE FUNCTION handle_new_user();
|
||||||
|
|
||||||
-- Table to store users' favourite study spaces
|
|
||||||
CREATE TABLE favourite_study_spaces (
|
|
||||||
user_id uuid REFERENCES users(id) ON DELETE CASCADE,
|
|
||||||
study_space_id uuid REFERENCES study_spaces(id) ON DELETE CASCADE,
|
|
||||||
created_at timestamp with time zone DEFAULT now(),
|
|
||||||
updated_at timestamp with time zone DEFAULT now(),
|
|
||||||
PRIMARY KEY (user_id, study_space_id)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TRIGGER favourite_study_spaces_updated_at
|
|
||||||
AFTER UPDATE ON favourite_study_spaces
|
|
||||||
FOR EACH ROW EXECUTE FUNCTION handle_updated_at();
|
|
||||||
|
|||||||
12
supabase/migrations/20250613105939_favourites.sql
Normal file
12
supabase/migrations/20250613105939_favourites.sql
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
-- Table to store users' favourite study spaces
|
||||||
|
CREATE TABLE favourite_study_spaces (
|
||||||
|
user_id uuid REFERENCES users(id) ON DELETE CASCADE,
|
||||||
|
study_space_id uuid REFERENCES study_spaces(id) ON DELETE CASCADE,
|
||||||
|
created_at timestamp with time zone DEFAULT now(),
|
||||||
|
updated_at timestamp with time zone DEFAULT now(),
|
||||||
|
PRIMARY KEY (user_id, study_space_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TRIGGER favourite_study_spaces_updated_at
|
||||||
|
AFTER UPDATE ON favourite_study_spaces
|
||||||
|
FOR EACH ROW EXECUTE FUNCTION handle_updated_at();
|
||||||
Reference in New Issue
Block a user