Skip to content

Commit 97d9c8d

Browse files
committed
feat: add safeBrowsingExpiry column to urls table
1 parent 2d94333 commit 97d9c8d

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- This adds the safeBrowsingExpiry column to the urls table, which is
2+
-- backwards-compatible with the current codebase as it allows NULL values.
3+
4+
BEGIN TRANSACTION;
5+
6+
ALTER TABLE urls ADD "safeBrowsingExpiry" TIMESTAMP WITH TIME ZONE;
7+
8+
COMMIT;
9+
10+
-- Down migration
11+
-- ALTER TABLE urls DROP COLUMN "safeBrowsingExpiry";

src/server/mappers/UrlMapper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export class UrlMapper implements Mapper<StorableUrl, UrlType> {
3232
contactEmail: urlType.contactEmail,
3333
source: urlType.source,
3434
tagStrings: urlType.tagStrings,
35+
safeBrowsingExpiry: urlType.safeBrowsingExpiry,
3536
}
3637
}
3738
}

src/server/models/url.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export interface UrlBaseType extends IdType {
2424
readonly description: string
2525
readonly source: StorableUrlSource
2626
readonly tagStrings: string
27+
readonly safeBrowsingExpiry: string | null
2728
}
2829

2930
export interface UrlType extends IdType, UrlBaseType, Sequelize.Model {
@@ -229,6 +230,10 @@ export const Url = <UrlTypeStatic>sequelize.define(
229230
allowNull: false,
230231
defaultValue: '',
231232
},
233+
safeBrowsingExpiry: {
234+
type: Sequelize.DATE,
235+
allowNull: true,
236+
},
232237
},
233238
{
234239
hooks: {

src/server/repositories/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export type StorableUrl = Pick<
1616
| 'contactEmail'
1717
| 'source'
1818
| 'tagStrings'
19+
| 'safeBrowsingExpiry'
1920
> &
2021
Pick<UrlClicksType, 'clicks'> & { tags?: string[] }
2122

0 commit comments

Comments
 (0)