-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
db/schema/020__tables/001/create_table__efp_leaderboard.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
-- migrate:up | ||
------------------------------------------------------------------------------- | ||
-- Table: efp_leaderboard | ||
------------------------------------------------------------------------------- | ||
CREATE TABLE | ||
public.efp_leaderboard ( | ||
"name" TEXT NOT NULL, | ||
"address" types.eth_address NOT NULL, | ||
"avatar" TEXT, | ||
"mutuals" BIGINT, | ||
"following" BIGINT, | ||
"followers" BIGINT, | ||
"blocks" BIGINT, | ||
created_at TIMESTAMP | ||
WITH | ||
TIME ZONE DEFAULT CURRENT_TIMESTAMP, | ||
updated_at TIMESTAMP | ||
WITH | ||
TIME ZONE DEFAULT CURRENT_TIMESTAMP, | ||
PRIMARY KEY ("address", "name") | ||
); | ||
|
||
CREATE TRIGGER | ||
update_efp_leaderboard_updated_at BEFORE | ||
UPDATE | ||
ON public.efp_leaderboard FOR EACH ROW | ||
EXECUTE | ||
FUNCTION public.update_updated_at_column(); | ||
|
||
-- migrate:down | ||
------------------------------------------------------------------------------- | ||
-- Undo Table: efp_leaderboard | ||
------------------------------------------------------------------------------- | ||
DROP TABLE | ||
IF EXISTS public.efp_leaderboard CASCADE; |