Skip to content

Commit

Permalink
fix: rename last_update to updated_at
Browse files Browse the repository at this point in the history
  • Loading branch information
ykhedher committed Nov 30, 2021
1 parent c3273ce commit 00f5740
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/lib/db/project-store.ts
Expand Up @@ -17,7 +17,7 @@ const COLUMNS = [
'description',
'created_at',
'health',
'last_update',
'updated_at',
];
const TABLE = 'projects';

Expand Down Expand Up @@ -81,7 +81,7 @@ class ProjectStore implements IProjectStore {
async updateHealth(healthUpdate: IProjectHealthUpdate): Promise<void> {
await this.db(TABLE)
.where({ id: healthUpdate.id })
.update({ health: healthUpdate.health, last_update: new Date() });
.update({ health: healthUpdate.health, updated_at: new Date() });
}

async create(project: IProjectInsert): Promise<IProject> {
Expand Down Expand Up @@ -204,7 +204,7 @@ class ProjectStore implements IProjectStore {
description: row.description,
createdAt: row.created_at,
health: row.health || 100,
lastUpdate: row.last_update || new Date(),
updatedAt: row.updated_at || new Date(),
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/services/project-health-service.ts
Expand Up @@ -72,7 +72,7 @@ export default class ProjectHealthService {
name: project.name,
description: project.description,
health: project.health,
lastUpdate: project.lastUpdate,
updatedAt: project.updatedAt,
environments,
features,
members,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/types/model.ts
Expand Up @@ -143,7 +143,7 @@ export interface IProjectOverview {
members: number;
version: number;
health: number;
lastUpdate?: Date;
updatedAt?: Date;
}

export interface IProjectHealthReport extends IProjectOverview {
Expand Down Expand Up @@ -310,7 +310,7 @@ export interface IProject {
description: string;
health?: number;
createdAt?: Date;
lastUpdate?: Date;
updatedAt?: Date;
}

export interface IProjectWithCount extends IProject {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/types/stores/project-store.ts
Expand Up @@ -5,7 +5,7 @@ export interface IProjectInsert {
id: string;
name: string;
description: string;
lastUpdate?: Date;
updatedAt?: Date;
}

export interface IProjectArchived {
Expand Down
12 changes: 0 additions & 12 deletions src/migrations/20211130093333-add-last-update-to-projects.js

This file was deleted.

12 changes: 12 additions & 0 deletions src/migrations/20211130142314-add-updated-at-to-projects.js
@@ -0,0 +1,12 @@
'use strict';

exports.up = function (db, callback) {
db.runSql(
'ALTER TABLE projects ADD COLUMN "updated_at" TIMESTAMP WITH TIME ZONE',
callback,
);
};

exports.down = function (db, callback) {
db.runSql('ALTER TABLE projects DROP COLUMN "updated_at";', callback);
};

0 comments on commit 00f5740

Please sign in to comment.