-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from aura-nw/dev
Dev
- Loading branch information
Showing
24 changed files
with
388 additions
and
413 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
hasura/metadata/databases/punkga-pg/tables/public_donate_history.yaml
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,10 @@ | ||
table: | ||
name: donate_history | ||
schema: public | ||
object_relationships: | ||
- name: creator | ||
using: | ||
foreign_key_constraint_on: creator_id | ||
- name: telegram_user | ||
using: | ||
foreign_key_constraint_on: telegram_id |
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
1 change: 1 addition & 0 deletions
1
hasura/migrations/punkga-pg/1724750116003_create_table_public_donate_history/down.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 @@ | ||
DROP TABLE "public"."donate_history"; |
17 changes: 17 additions & 0 deletions
17
hasura/migrations/punkga-pg/1724750116003_create_table_public_donate_history/up.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,17 @@ | ||
CREATE TABLE "public"."donate_history" ("id" serial NOT NULL, "telegram_id" text NOT NULL, "creator_id" integer NOT NULL, "txn" text NOT NULL, "value" text NOT NULL, "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), PRIMARY KEY ("id") , FOREIGN KEY ("telegram_id") REFERENCES "public"."telegram_users"("telegram_id") ON UPDATE cascade ON DELETE cascade, FOREIGN KEY ("creator_id") REFERENCES "public"."creators"("id") ON UPDATE cascade ON DELETE cascade); | ||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"() | ||
RETURNS TRIGGER AS $$ | ||
DECLARE | ||
_new record; | ||
BEGIN | ||
_new := NEW; | ||
_new."updated_at" = NOW(); | ||
RETURN _new; | ||
END; | ||
$$ LANGUAGE plpgsql; | ||
CREATE TRIGGER "set_public_donate_history_updated_at" | ||
BEFORE UPDATE ON "public"."donate_history" | ||
FOR EACH ROW | ||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"(); | ||
COMMENT ON TRIGGER "set_public_donate_history_updated_at" ON "public"."donate_history" | ||
IS 'trigger to set value of column "updated_at" to current timestamp on row update'; |
2 changes: 2 additions & 0 deletions
2
...ions/punkga-pg/1724753071695_alter_table_public_donate_history_drop_column_value/down.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,2 @@ | ||
alter table "public"."donate_history" alter column "value" drop not null; | ||
alter table "public"."donate_history" add column "value" text; |
1 change: 1 addition & 0 deletions
1
...ations/punkga-pg/1724753071695_alter_table_public_donate_history_drop_column_value/up.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 @@ | ||
alter table "public"."donate_history" drop column "value" cascade; |
4 changes: 4 additions & 0 deletions
4
...tions/punkga-pg/1724753114236_alter_table_public_donate_history_add_column_value/down.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,4 @@ | ||
-- Could not auto-generate a down migration. | ||
-- Please write an appropriate down migration for the SQL below: | ||
-- alter table "public"."donate_history" add column "value" Integer | ||
-- null; |
2 changes: 2 additions & 0 deletions
2
...rations/punkga-pg/1724753114236_alter_table_public_donate_history_add_column_value/up.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,2 @@ | ||
alter table "public"."donate_history" add column "value" Integer | ||
null; |
18 changes: 18 additions & 0 deletions
18
hasura/migrations/punkga-pg/1725436648296_update_show_album_trigger/down.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,18 @@ | ||
-- Could not auto-generate a down migration. | ||
-- Please write an appropriate down migration for the SQL below: | ||
-- CREATE OR REPLACE FUNCTION update_show_album_fnc() RETURNS trigger AS $$ | ||
-- DECLARE | ||
-- cnt integer; | ||
-- BEGIN | ||
-- SELECT count(*) INTO cnt FROM artworks a WHERE a.album_id = OLD.album_id; | ||
-- IF cnt = 0 THEN | ||
-- UPDATE albums SET show = false WHERE id = OLD.album_id; | ||
-- END IF; | ||
-- RETURN OLD; | ||
-- END; | ||
-- $$ LANGUAGE plpgsql; | ||
-- | ||
-- CREATE OR REPLACE TRIGGER update_show_album | ||
-- AFTER DELETE ON artworks | ||
-- FOR EACH ROW | ||
-- EXECUTE FUNCTION update_show_album_fnc(); |
16 changes: 16 additions & 0 deletions
16
hasura/migrations/punkga-pg/1725436648296_update_show_album_trigger/up.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,16 @@ | ||
CREATE OR REPLACE FUNCTION update_show_album_fnc() RETURNS trigger AS $$ | ||
DECLARE | ||
cnt integer; | ||
BEGIN | ||
SELECT count(*) INTO cnt FROM artworks a WHERE a.album_id = OLD.album_id; | ||
IF cnt = 0 THEN | ||
UPDATE albums SET show = false WHERE id = OLD.album_id; | ||
END IF; | ||
RETURN OLD; | ||
END; | ||
$$ LANGUAGE plpgsql; | ||
|
||
CREATE OR REPLACE TRIGGER update_show_album | ||
AFTER DELETE ON artworks | ||
FOR EACH ROW | ||
EXECUTE FUNCTION update_show_album_fnc(); |
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
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 |
---|---|---|
|
@@ -3,4 +3,5 @@ export class UserDto { | |
roles: string[]; | ||
token: string; | ||
telegramUserId?: string; | ||
telegramId?: string; | ||
} |
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
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
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
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
Oops, something went wrong.