This repository was archived by the owner on Mar 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expiration time support #2
Open
cafercangundogdu
wants to merge
9
commits into
main
Choose a base branch
from
expiration_time_support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c58fa58
Added deadline column to poll
cafercangundogdu d814a74
Added deadline column migration
cafercangundogdu a0d6354
Added deadline field when creating pool
cafercangundogdu c830f7f
Added deadline inputs to poll-form
cafercangundogdu 6d9c235
Checking deadline on actions
cafercangundogdu 893fae3
Fixed a few linting issues
m-ali-akbay c127001
Added moment dependency
cafercangundogdu b5005a4
Made compatible with different timezones
cafercangundogdu ade1cd1
Fix variable name
cafercangundogdu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
52 changes: 52 additions & 0 deletions
52
src/migrations/1639772969440-AddDeadlineColumnInPollTable.ts
This file contains hidden or 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,52 @@ | ||
| import {MigrationInterface, QueryRunner} from "typeorm"; | ||
|
|
||
| export class AddDeadlineColumnInPollTable1639772969440 implements MigrationInterface { | ||
| name = 'AddDeadlineColumnInPollTable1639772969440' | ||
|
|
||
| public async up(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query(`CREATE TABLE "temporary_vote" ("option_id" varchar NOT NULL, "vote_right_id" varchar PRIMARY KEY NOT NULL, CONSTRAINT "FK_ce69ed4c96964be74d3d57e89cb" FOREIGN KEY ("vote_right_id") REFERENCES "vote_right" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT "FK_d17980c91005358383b7ad59ab0" FOREIGN KEY ("option_id") REFERENCES "option" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT)`); | ||
| await queryRunner.query(`INSERT INTO "temporary_vote"("option_id", "vote_right_id") SELECT "option_id", "vote_right_id" FROM "vote"`); | ||
| await queryRunner.query(`DROP TABLE "vote"`); | ||
| await queryRunner.query(`ALTER TABLE "temporary_vote" RENAME TO "vote"`); | ||
| await queryRunner.query(`CREATE TABLE "temporary_poll" ("id" varchar PRIMARY KEY NOT NULL, "user_id" varchar NOT NULL, "deadline" datetime NOT NULL)`); | ||
| await queryRunner.query(`INSERT INTO "temporary_poll"("id", "user_id") SELECT "id", "user_id" FROM "poll"`); | ||
| await queryRunner.query(`DROP TABLE "poll"`); | ||
| await queryRunner.query(`ALTER TABLE "temporary_poll" RENAME TO "poll"`); | ||
| await queryRunner.query(`CREATE TABLE "temporary_vote" ("option_id" varchar NOT NULL, "vote_right_id" varchar PRIMARY KEY NOT NULL)`); | ||
| await queryRunner.query(`INSERT INTO "temporary_vote"("option_id", "vote_right_id") SELECT "option_id", "vote_right_id" FROM "vote"`); | ||
| await queryRunner.query(`DROP TABLE "vote"`); | ||
| await queryRunner.query(`ALTER TABLE "temporary_vote" RENAME TO "vote"`); | ||
| await queryRunner.query(`CREATE TABLE "temporary_vote" ("option_id" varchar NOT NULL, "vote_right_id" varchar PRIMARY KEY NOT NULL, CONSTRAINT "UQ_1f4ba94e11f0f6afec9cb013d4e" UNIQUE ("vote_right_id"))`); | ||
| await queryRunner.query(`INSERT INTO "temporary_vote"("option_id", "vote_right_id") SELECT "option_id", "vote_right_id" FROM "vote"`); | ||
| await queryRunner.query(`DROP TABLE "vote"`); | ||
| await queryRunner.query(`ALTER TABLE "temporary_vote" RENAME TO "vote"`); | ||
| await queryRunner.query(`CREATE TABLE "temporary_vote" ("option_id" varchar NOT NULL, "vote_right_id" varchar PRIMARY KEY NOT NULL, CONSTRAINT "UQ_1f4ba94e11f0f6afec9cb013d4e" UNIQUE ("vote_right_id"), CONSTRAINT "FK_d17980c91005358383b7ad59ab0" FOREIGN KEY ("option_id") REFERENCES "option" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT "FK_ce69ed4c96964be74d3d57e89cb" FOREIGN KEY ("vote_right_id") REFERENCES "vote_right" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT)`); | ||
| await queryRunner.query(`INSERT INTO "temporary_vote"("option_id", "vote_right_id") SELECT "option_id", "vote_right_id" FROM "vote"`); | ||
| await queryRunner.query(`DROP TABLE "vote"`); | ||
| await queryRunner.query(`ALTER TABLE "temporary_vote" RENAME TO "vote"`); | ||
| } | ||
|
|
||
| public async down(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query(`ALTER TABLE "vote" RENAME TO "temporary_vote"`); | ||
| await queryRunner.query(`CREATE TABLE "vote" ("option_id" varchar NOT NULL, "vote_right_id" varchar PRIMARY KEY NOT NULL, CONSTRAINT "UQ_1f4ba94e11f0f6afec9cb013d4e" UNIQUE ("vote_right_id"))`); | ||
| await queryRunner.query(`INSERT INTO "vote"("option_id", "vote_right_id") SELECT "option_id", "vote_right_id" FROM "temporary_vote"`); | ||
| await queryRunner.query(`DROP TABLE "temporary_vote"`); | ||
| await queryRunner.query(`ALTER TABLE "vote" RENAME TO "temporary_vote"`); | ||
| await queryRunner.query(`CREATE TABLE "vote" ("option_id" varchar NOT NULL, "vote_right_id" varchar PRIMARY KEY NOT NULL)`); | ||
| await queryRunner.query(`INSERT INTO "vote"("option_id", "vote_right_id") SELECT "option_id", "vote_right_id" FROM "temporary_vote"`); | ||
| await queryRunner.query(`DROP TABLE "temporary_vote"`); | ||
| await queryRunner.query(`ALTER TABLE "vote" RENAME TO "temporary_vote"`); | ||
| await queryRunner.query(`CREATE TABLE "vote" ("option_id" varchar NOT NULL, "vote_right_id" varchar PRIMARY KEY NOT NULL, CONSTRAINT "FK_ce69ed4c96964be74d3d57e89cb" FOREIGN KEY ("vote_right_id") REFERENCES "vote_right" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT)`); | ||
| await queryRunner.query(`INSERT INTO "vote"("option_id", "vote_right_id") SELECT "option_id", "vote_right_id" FROM "temporary_vote"`); | ||
| await queryRunner.query(`DROP TABLE "temporary_vote"`); | ||
| await queryRunner.query(`ALTER TABLE "poll" RENAME TO "temporary_poll"`); | ||
| await queryRunner.query(`CREATE TABLE "poll" ("id" varchar PRIMARY KEY NOT NULL, "user_id" varchar NOT NULL)`); | ||
| await queryRunner.query(`INSERT INTO "poll"("id", "user_id") SELECT "id", "user_id" FROM "temporary_poll"`); | ||
| await queryRunner.query(`DROP TABLE "temporary_poll"`); | ||
| await queryRunner.query(`ALTER TABLE "vote" RENAME TO "temporary_vote"`); | ||
| await queryRunner.query(`CREATE TABLE "vote" ("option_id" varchar NOT NULL, "vote_right_id" varchar PRIMARY KEY NOT NULL, CONSTRAINT "FK_ce69ed4c96964be74d3d57e89cb" FOREIGN KEY ("vote_right_id") REFERENCES "vote_right" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT "FK_d17980c91005358383b7ad59ab0" FOREIGN KEY ("option_id") REFERENCES "option" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT)`); | ||
| await queryRunner.query(`INSERT INTO "vote"("option_id", "vote_right_id") SELECT "option_id", "vote_right_id" FROM "temporary_vote"`); | ||
| await queryRunner.query(`DROP TABLE "temporary_vote"`); | ||
| } | ||
|
|
||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| import { Initial1638093041896 } from "./1638093041896-Initial"; | ||
| import { AddUserIdColumnInPollTable1638098141565 } from "./1638098141565-AddUserIdColumnInPollTable"; | ||
| import { AddDeadlineColumnInPollTable1639772969440 } from "./1639772969440-AddDeadlineColumnInPollTable"; | ||
|
|
||
| export const migrations = [ | ||
| Initial1638093041896, | ||
| AddUserIdColumnInPollTable1638098141565, | ||
| AddDeadlineColumnInPollTable1639772969440, | ||
| ] |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
momentis being deprecated, please use the successor,date-fns.