Skip to content

Commit

Permalink
Populate Greenbox table via the migration instead of a script
Browse files Browse the repository at this point in the history
  • Loading branch information
soolar committed Nov 25, 2023
1 parent 777b6e1 commit b8d45c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 31 deletions.
31 changes: 0 additions & 31 deletions makegreenboxtable.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ CREATE TABLE "Greenbox" (

-- AddForeignKey
ALTER TABLE "Greenbox" ADD CONSTRAINT "Greenbox_playerId_fkey" FOREIGN KEY ("playerId") REFERENCES "Player"("playerId") ON DELETE RESTRICT ON UPDATE CASCADE;

INSERT INTO "Greenbox" ("playerId", "data", "time")
SELECT "playerId", "greenboxString" as "data", "greenboxLastUpdate" as "time"
FROM "Player"
WHERE "greenboxString" IS NOT NULL AND "greenboxLastUpdate" IS NOT NULL;

0 comments on commit b8d45c4

Please sign in to comment.