Skip to content

Commit

Permalink
fix: rm-gap-title-abstract-len-constraint
Browse files Browse the repository at this point in the history
Remove len constraints for gap.title and gap.abstract (was 80 and 2500 char length)
fixed error if db data is undefined when fetching from db sync
  • Loading branch information
BEdev24 authored Sep 11, 2024
1 parent ed36368 commit 565adb0
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class Migrations1726048356332 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`begin;
ALTER TABLE gov_action_proposals
ALTER COLUMN title TYPE VARCHAR;
ALTER TABLE gov_action_proposals
alter COLUMN abstract type VARCHAR;
commit;`,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`begin;
ALTER TABLE gov_action_proposals
ALTER COLUMN title TYPE VARCHAR(80);
ALTER TABLE gov_action_proposals
alter COLUMN abstract type VARCHAR(2500);
commit;`,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ export class GovActionProposal extends CommonEntity {
@Column({
name: 'title',
type: 'varchar',
length: 80,
nullable: true,
})
title: string;

@Column({
name: 'abstract',
type: 'varchar',
length: 2500,
nullable: true,
})
abstract: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class GovActionProposalService extends CommonService {
);
const results: GovActionProposalRequest[] = [];

dbData.forEach((govActionProposal) => {
dbData?.forEach((govActionProposal) => {
results.push(
GovActionProposalMapper.dbSyncToGovActionProposalRequest(
govActionProposal,
Expand Down
2 changes: 1 addition & 1 deletion worker-service/src/governance/services/vote.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export class VoteService extends CommonService {
addresses,
);
const results: VoteRequest[] = [];
dbData.forEach((vote) => {
dbData?.forEach((vote) => {
results.push(VoteMapper.dbSyncToVoteRequest(vote, mapHotAddresses));
});
return results;
Expand Down

0 comments on commit 565adb0

Please sign in to comment.