Skip to content

Commit 9814bce

Browse files
remove hashing (#59)
1 parent 7091d0a commit 9814bce

File tree

2 files changed

+2
-45
lines changed

2 files changed

+2
-45
lines changed

infra/bigquery-export/firestore.js

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
import { Firestore } from '@google-cloud/firestore'
22
import { BigQueryExport } from './bigquery.js'
3-
import { technologyHashId } from './utils.js'
4-
5-
const TECHNOLOGY_QUERY_ID_KEYS = {
6-
adoption: ['date', 'technology', 'geo', 'rank'],
7-
lighthouse: ['date', 'technology', 'geo', 'rank'],
8-
core_web_vitals: ['date', 'technology', 'geo', 'rank'],
9-
page_weight: ['date', 'technology', 'geo', 'rank'],
10-
technologies: ['client', 'technology', 'category'],
11-
categories: ['category']
12-
}
133

144
export class FirestoreBatch {
155
constructor () {
@@ -26,8 +16,7 @@ export class FirestoreBatch {
2616
if (operation === 'delete') {
2717
batch.delete(doc.ref)
2818
} else if (operation === 'set') {
29-
const docId = technologyHashId(doc, this.collectionName, TECHNOLOGY_QUERY_ID_KEYS)
30-
const docRef = this.firestore.collection(this.collectionName).doc(docId)
19+
const docRef = this.firestore.collection(this.collectionName).doc()
3120
batch.set(docRef, doc)
3221
} else {
3322
throw new Error('Invalid operation')
@@ -144,10 +133,7 @@ export class FirestoreBatch {
144133
databaseId: 'tech-report-apis-' + exportConfig.environment
145134
})
146135

147-
// Delete all the documents before writing the new ones
148-
if (exportConfig.truncate !== 'false') {
149-
await this.batchDelete()
150-
}
136+
await this.batchDelete()
151137

152138
const rowStream = await this.bigquery.queryResultsStream(query)
153139
await this.streamFromBigQuery(rowStream)

infra/bigquery-export/utils.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)