diff --git a/docker-compose-local-postgres-redis.yml b/docker-compose-local-postgres-redis.yml new file mode 100644 index 000000000..d89a97187 --- /dev/null +++ b/docker-compose-local-postgres-redis.yml @@ -0,0 +1,55 @@ +version: '3.3' + +services: + impact-graph-postgres: + # Use this postgres image https://github.com/Giveth/postgres-givethio + image: ghcr.io/giveth/postgres-givethio:latest + restart: always + environment: + - POSTGRES_DB=givethio + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + - PGDATA=/var/lib/postgresql/data/pgdata + ports: + - "5442:5432" + volumes: + - db-data:/var/lib/postgresql/data + + impact-graph-postgres-test: + # CAUTION: Running tests will delete all records of this db, so just use this container for test + # For running application use above container port: 5442 + + # Use this postgres image https://github.com/Giveth/postgres-givethio + image: ghcr.io/giveth/postgres-givethio:latest + restart: always + environment: + - POSTGRES_DB=givethio + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + - PGDATA=/var/lib/postgresql/data/pgdata + ports: + - "5443:5432" + volumes: + - db-data-test:/var/lib/postgresql/data + + redis-giveth: + # it's better to not using the latest tag, maybe latest tag have some breaking changes + image: redis:7.2.0-alpine3.18 + container_name: redis-giveth + environment: + - REDIS_ALLOW_EMPTY_PASSWORD=yes + restart: always + ports: + - "6379:6379" + volumes: + - redis-data:/data + +volumes: + db-data: + db-data-test: + redis-data: + +networks: + giveth: + external: true + diff --git a/migration/1724112704036-AddEmailConfirmationFieldsToUserTable.ts b/migration/1724112704036-AddEmailConfirmationFieldsToUserTable.ts deleted file mode 100644 index 8ebac920f..000000000 --- a/migration/1724112704036-AddEmailConfirmationFieldsToUserTable.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm'; - -export class AddEmailConfirmationFieldsToUserTable1724112704036 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.addColumn( - 'user', - new TableColumn({ - name: 'emailConfirmed', - type: 'boolean', - default: false, - isNullable: false, - }), - ); - - await queryRunner.addColumn( - 'user', - new TableColumn({ - name: 'emailConfirmationSent', - type: 'boolean', - default: false, - isNullable: false, - }), - ); - - await queryRunner.addColumn( - 'user', - new TableColumn({ - name: 'emailConfirmationSentAt', - type: 'timestamptz', - isNullable: true, - }), - ); - - await queryRunner.addColumn( - 'user', - new TableColumn({ - name: 'emailConfirmedAt', - type: 'timestamptz', - isNullable: true, - }), - ); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.dropColumn('user', 'emailConfirmed'); - await queryRunner.dropColumn('user', 'emailConfirmationSent'); - await queryRunner.dropColumn('user', 'emailConfirmationSentAt'); - await queryRunner.dropColumn('user', 'emailConfirmedAt'); - } -} diff --git a/migration/1724112826669-CreateUserEmailVerificationTable.ts b/migration/1724112826669-CreateUserEmailVerificationTable.ts deleted file mode 100644 index 409649587..000000000 --- a/migration/1724112826669-CreateUserEmailVerificationTable.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { - MigrationInterface, - QueryRunner, - Table, - TableForeignKey, -} from 'typeorm'; - -export class CreateUserEmailVerificationTable1724112826669 - implements MigrationInterface -{ - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.createTable( - new Table({ - name: 'user_email_verification', - columns: [ - { - name: 'id', - type: 'int', - isPrimary: true, - isGenerated: true, - generationStrategy: 'increment', - }, - { - name: 'userId', - type: 'int', - }, - { - name: 'emailVerificationCode', - type: 'text', - isNullable: true, - }, - { - name: 'emailVerificationCodeExpiredAt', - type: 'timestamptz', - isNullable: true, - }, - ], - }), - true, - ); - - await queryRunner.createForeignKey( - 'user_email_verification', - new TableForeignKey({ - columnNames: ['userId'], - referencedColumnNames: ['id'], - referencedTableName: 'user', - onDelete: 'CASCADE', - }), - ); - } - - public async down(queryRunner: QueryRunner): Promise { - const table = await queryRunner.getTable('user_email_verification'); - const foreignKey = table?.foreignKeys.find( - fk => fk.columnNames.indexOf('userId') !== -1, - ); - if (foreignKey) { - await queryRunner.dropForeignKey('user_email_verification', foreignKey); - } - await queryRunner.dropTable('user_email_verification'); - } -} diff --git a/migration/1724143752405-EmailVerification.ts b/migration/1724143752405-EmailVerification.ts new file mode 100644 index 000000000..9916ff59a --- /dev/null +++ b/migration/1724143752405-EmailVerification.ts @@ -0,0 +1,45 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class EmailVerification1724143752405 implements MigrationInterface { + name = 'EmailVerification1724143752405'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `CREATE TABLE "user_email_verification" ("id" SERIAL NOT NULL, "userId" integer NOT NULL, "emailVerificationCode" text, "emailVerificationCodeExpiredAt" TIMESTAMP WITH TIME ZONE, CONSTRAINT "PK_8ad3e54beb79f46d33950e9d487" PRIMARY KEY ("id"))`, + ); + await queryRunner.query( + `ALTER TABLE "user" ADD "emailConfirmed" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `ALTER TABLE "user" ADD "emailConfirmationSent" boolean NOT NULL DEFAULT false`, + ); + await queryRunner.query( + `ALTER TABLE "user" ADD "emailConfirmationSentAt" TIMESTAMP WITH TIME ZONE`, + ); + await queryRunner.query( + `ALTER TABLE "user" ADD "emailConfirmedAt" TIMESTAMP WITH TIME ZONE`, + ); + await queryRunner.query( + `ALTER TABLE "project" ADD "teaser" character varying`, + ); + await queryRunner.query(`ALTER TABLE "project" ADD "teamMembers" jsonb`); + await queryRunner.query(`ALTER TABLE "project" ADD "abc" jsonb`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "project" DROP COLUMN "abc"`); + await queryRunner.query(`ALTER TABLE "project" DROP COLUMN "teamMembers"`); + await queryRunner.query(`ALTER TABLE "project" DROP COLUMN "teaser"`); + await queryRunner.query( + `ALTER TABLE "user" DROP COLUMN "emailConfirmedAt"`, + ); + await queryRunner.query( + `ALTER TABLE "user" DROP COLUMN "emailConfirmationSentAt"`, + ); + await queryRunner.query( + `ALTER TABLE "user" DROP COLUMN "emailConfirmationSent"`, + ); + await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "emailConfirmed"`); + await queryRunner.query(`DROP TABLE "user_email_verification"`); + } +} diff --git a/src/entities/project.ts b/src/entities/project.ts index f5d7dab48..31a211a17 100644 --- a/src/entities/project.ts +++ b/src/entities/project.ts @@ -153,6 +153,8 @@ export class Abc { @Entity() @ObjectType() +@Index('trgm_idx_project_title', { synchronize: false }) +@Index('trgm_idx_project_description', { synchronize: false }) export class Project extends BaseEntity { @Field(_type => ID) @PrimaryGeneratedColumn()