Change last_updated_at to dateTime
Signed-off-by: iris <hellocomplex007@gmail.com>
This commit is contained in:
+1
-1
@@ -17,7 +17,7 @@
|
||||
exports.up = async function up(knex) {
|
||||
await knex.schema.table('final_entities', table => {
|
||||
table
|
||||
.bigint('last_updated_at')
|
||||
.dateTime('last_updated_at')
|
||||
.nullable()
|
||||
.comment('The time when final_entity changed');
|
||||
});
|
||||
|
||||
@@ -66,7 +66,7 @@ export type DbFinalEntitiesRow = {
|
||||
hash: string;
|
||||
stitch_ticket: string;
|
||||
final_entity?: string;
|
||||
last_updated_at: string | null;
|
||||
last_updated_at: string | Date;
|
||||
};
|
||||
|
||||
export type DbSearchRow = {
|
||||
|
||||
@@ -23,7 +23,6 @@ import {
|
||||
import { SerializedError, stringifyError } from '@backstage/errors';
|
||||
import { Knex } from 'knex';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { DateTime } from 'luxon';
|
||||
import { Logger } from 'winston';
|
||||
import {
|
||||
DbFinalEntitiesRow,
|
||||
@@ -208,12 +207,12 @@ export class Stitcher {
|
||||
.update({
|
||||
final_entity: JSON.stringify(entity),
|
||||
hash,
|
||||
last_updated_at: `${DateTime.now().toMillis()}`,
|
||||
last_updated_at: this.database.fn.now(),
|
||||
})
|
||||
.where('entity_id', entityId)
|
||||
.where('stitch_ticket', ticket)
|
||||
.onConflict('entity_id')
|
||||
.merge(['final_entity', 'hash']);
|
||||
.merge(['final_entity', 'hash', 'last_updated_at']);
|
||||
|
||||
if (amountOfRowsChanged === 0) {
|
||||
this.logger.debug(
|
||||
|
||||
Reference in New Issue
Block a user