Skip to content

Commit

Permalink
fix test pgsql db init
Browse files Browse the repository at this point in the history
  • Loading branch information
jkavalik committed Oct 8, 2024
1 parent 01b9878 commit 454bb65
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions tests/db/pgsql-init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -120,38 +120,6 @@ CREATE TABLE "photos"
CONSTRAINT "photos_album_id" FOREIGN KEY ("album_id") REFERENCES "photo_albums" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);

CREATE TABLE "user_stats_x" (
"user_id" int NOT NULL,
"date" TIMESTAMPTZ NOT NULL,
"value" int NOT NULL,
PRIMARY KEY("user_id", "date"),
CONSTRAINT "user_stats_x_user_id" FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);


CREATE TABLE "users_x_users" (
"my_friends_id" int NOT NULL,
"friends_with_me_id" int NOT NULL,
PRIMARY KEY ("my_friends_id", "friends_with_me_id"),
CONSTRAINT "my_friends_key" FOREIGN KEY ("my_friends_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT "friends_with_me_key" FOREIGN KEY ("friends_with_me_id") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);


CREATE FUNCTION "book_collections_before"() RETURNS TRIGGER AS $BODY$BEGIN
NEW."updated_at" = NOW();
return NEW;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;

CREATE TRIGGER "book_collections_before_insert_trigger" BEFORE INSERT ON "book_collections"
FOR EACH ROW EXECUTE PROCEDURE "book_collections_before"();

CREATE TRIGGER "book_collections_before_update_trigger" BEFORE UPDATE ON "book_collections"
FOR EACH ROW EXECUTE PROCEDURE "book_collections_before"();


CREATE TABLE "photo_albums" (
"id" serial4 NOT NULL,
"title" varchar(255) NOT NULL,
Expand Down

0 comments on commit 454bb65

Please sign in to comment.