mirror of
https://github.com/OHTU-German-learning-website/OHTU-German-learning-website.git
synced 2026-10-12 19:13:51 +03:00
Fixed line endings in schema.sql
This commit is contained in:
+20
-20
@@ -1,32 +1,32 @@
|
||||
CREATE OR REPLACE FUNCTION public.insert_into_exercises()
|
||||
RETURNS trigger
|
||||
LANGUAGE plpgsql
|
||||
AS $function$
|
||||
DECLARE
|
||||
new_exercise_id BIGINT;
|
||||
BEGIN
|
||||
-- Insert a new row into the exercises table
|
||||
INSERT INTO exercises (created_at, updated_at, category)
|
||||
VALUES (NOW(), NOW(), 'click')
|
||||
RETURNING id INTO new_exercise_id;
|
||||
|
||||
-- Link the new exercise to the click_exercises entry
|
||||
INSERT INTO click_to_exercises (click_id, exercise_id, created_at, updated_at)
|
||||
VALUES (NEW.id, new_exercise_id, NOW(), NOW());
|
||||
|
||||
RETURN NEW;
|
||||
END;
|
||||
AS $function$
|
||||
DECLARE
|
||||
new_exercise_id BIGINT;
|
||||
BEGIN
|
||||
-- Insert a new row into the exercises table
|
||||
INSERT INTO exercises (created_at, updated_at, category)
|
||||
VALUES (NOW(), NOW(), 'click')
|
||||
RETURNING id INTO new_exercise_id;
|
||||
|
||||
-- Link the new exercise to the click_exercises entry
|
||||
INSERT INTO click_to_exercises (click_id, exercise_id, created_at, updated_at)
|
||||
VALUES (NEW.id, new_exercise_id, NOW(), NOW());
|
||||
|
||||
RETURN NEW;
|
||||
END;
|
||||
$function$
|
||||
;
|
||||
|
||||
CREATE OR REPLACE FUNCTION public.updated_at()
|
||||
RETURNS trigger
|
||||
LANGUAGE plpgsql
|
||||
AS $function$
|
||||
BEGIN
|
||||
NEW.updated_at = NOW();
|
||||
RETURN NEW;
|
||||
END;
|
||||
AS $function$
|
||||
BEGIN
|
||||
NEW.updated_at = NOW();
|
||||
RETURN NEW;
|
||||
END;
|
||||
$function$
|
||||
;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user