Skip to content

Commit

Permalink
fix: revert migration
Browse files Browse the repository at this point in the history
  • Loading branch information
dzehnder committed Dec 24, 2024
1 parent aedfc23 commit 439cb8c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 89 deletions.
30 changes: 0 additions & 30 deletions packages/spacecat-shared-data-access/src/migration.js

This file was deleted.

82 changes: 23 additions & 59 deletions packages/spacecat-shared-data-access/test/it/util/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import { createDataAccess } from '../../../src/service/index.js';
export const TEST_DA_CONFIG = {
indexNameAllImportJobsByDateRange: 'spacecat-services-all-import-jobs-by-date-range',
indexNameAllImportJobsByStatus: 'spacecat-services-all-import-jobs-by-status',
indexNameAllKeyEventsBySiteId: 'spacecat-services-key-events-by-site-id-dev',
indexNameAllKeyEventsBySiteId: 'spacecat-services-key-events-by-site-id',
indexNameAllLatestAuditScores: 'spacecat-services-all-latest-audit-scores',
indexNameAllOrganizations: 'spacecat-services-all-organizations-dev',
indexNameAllOrganizationsByImsOrgId: 'spacecat-services-all-organizations-by-ims-org-id-dev',
indexNameAllSites: 'spacecat-services-all-sites-dev',
indexNameAllSitesByDeliveryType: 'spacecat-services-all-sites-by-delivery-type-dev',
indexNameAllSitesOrganizations: 'spacecat-services-all-sites-organizations-dev',
indexNameAllOrganizations: 'spacecat-services-all-organizations',
indexNameAllOrganizationsByImsOrgId: 'spacecat-services-all-organizations-by-ims-org-id',
indexNameAllSites: 'spacecat-services-all-sites',
indexNameAllSitesByDeliveryType: 'spacecat-services-all-sites-by-delivery-type',
indexNameAllSitesOrganizations: 'spacecat-services-all-sites-organizations',
indexNameApiKeyByHashedApiKey: 'spacecat-services-api-key-by-hashed-api-key',
indexNameApiKeyByImsUserIdAndImsOrgId: 'spacecat-services-api-key-by-ims-user-id-and-ims-org-id',
indexNameImportUrlsByJobIdAndStatus: 'spacecat-services-all-import-urls-by-job-id-and-status',
Expand All @@ -33,54 +33,22 @@ export const TEST_DA_CONFIG = {
pkAllLatestAudits: 'ALL_LATEST_AUDITS',
pkAllOrganizations: 'ALL_ORGANIZATIONS',
pkAllSites: 'ALL_SITES',
tableNameApiKeys: 'spacecat-services-api-keys-dev',
tableNameAudits: 'spacecat-services-audits-dev',
tableNameConfigurations: 'spacecat-services-configurations-dev',
tableNameData: 'spacecat-services-data-dev',
tableNameExperiments: 'spacecat-services-experiments-dev',
tableNameImportJobs: 'spacecat-services-import-jobs-dev',
tableNameImportUrls: 'spacecat-services-import-urls-dev',
tableNameKeyEvents: 'spacecat-services-key-events-dev',
tableNameLatestAudits: 'spacecat-services-latest-audits-dev',
tableNameOrganizations: 'spacecat-services-organizations-dev',
tableNameSiteCandidates: 'spacecat-services-site-candidates-dev',
tableNameSiteTopPages: 'spacecat-services-site-top-pages-dev',
tableNameSites: 'spacecat-services-sites-dev',
tableNameSpacecatData: 'spacecat-services-data-dev',
};
export const TEST_DA_MIGRATION_CONFIG = {
indexNameAllImportJobsByDateRange: 'spacecat-services-all-import-jobs-by-date-range',
indexNameAllImportJobsByStatus: 'spacecat-services-all-import-jobs-by-status',
indexNameAllKeyEventsBySiteId: 'spacecat-services-key-events-by-site-id-dev',
indexNameAllLatestAuditScores: 'spacecat-services-all-latest-audit-scores',
indexNameAllOrganizations: 'spacecat-services-all-organizations-dev',
indexNameAllOrganizationsByImsOrgId: 'spacecat-services-all-organizations-by-ims-org-id-dev',
indexNameAllSites: 'spacecat-services-all-sites-dev',
indexNameAllSitesByDeliveryType: 'spacecat-services-all-sites-by-delivery-type-dev',
indexNameAllSitesOrganizations: 'spacecat-services-all-sites-organizations-dev',
indexNameApiKeyByHashedApiKey: 'spacecat-services-api-key-by-hashed-api-key',
indexNameApiKeyByImsUserIdAndImsOrgId: 'spacecat-services-api-key-by-ims-user-id-and-ims-org-id',
indexNameImportUrlsByJobIdAndStatus: 'spacecat-services-all-import-urls-by-job-id-and-status',
pkAllConfigurations: 'ALL_CONFIGURATIONS',
pkAllImportJobs: 'ALL_IMPORT_JOBS',
pkAllLatestAudits: 'ALL_LATEST_AUDITS',
pkAllOrganizations: 'ALL_ORGANIZATIONS',
pkAllSites: 'ALL_SITES',
tableNameApiKeys: 'spacecat-services-api-keys-dev',
tableNameAudits: 'spacecat-services-audits-dev',
tableNameConfigurations: 'spacecat-services-configurations-dev',
tableNameData: 'spacecat-services-data-dev',
tableNameExperiments: 'spacecat-services-experiments-dev',
tableNameImportJobs: 'spacecat-services-import-jobs-dev',
tableNameImportUrls: 'spacecat-services-import-urls-dev',
tableNameKeyEvents: 'spacecat-services-key-events-dev',
tableNameLatestAudits: 'spacecat-services-latest-audits-dev',
tableNameOrganizations: 'spacecat-services-organizations-dev',
tableNameSiteCandidates: 'spacecat-services-site-candidates-dev',
tableNameSiteTopPages: 'spacecat-services-site-top-pages-dev',
tableNameSites: 'spacecat-services-sites-dev',
tableNameSpacecatData: 'spacecat-services-data-dev',
tableNameApiKeys: 'spacecat-services-api-keys',
tableNameAudits: 'spacecat-services-audits',
tableNameConfigurations: 'spacecat-services-configurations',
tableNameData: 'spacecat-services-data',
tableNameExperiments: 'spacecat-services-experiments',
tableNameImportJobs: 'spacecat-services-import-jobs',
tableNameImportUrls: 'spacecat-services-import-urls',
tableNameKeyEvents: 'spacecat-services-key-events',
tableNameLatestAudits: 'spacecat-services-latest-audits',
tableNameOrganizations: 'spacecat-services-organizations',
tableNameSiteCandidates: 'spacecat-services-site-candidates',
tableNameSiteTopPages: 'spacecat-services-site-top-pages',
tableNameSites: 'spacecat-services-sites',
tableNameSpacecatData: 'spacecat-data',
};

let docClient = null;

const getDynamoClients = (config = {}) => {
Expand All @@ -102,13 +70,9 @@ const getDynamoClients = (config = {}) => {
return { dbClient, docClient };
};

export const getDataAccess = (config, isMigration) => {
export const getDataAccess = (config) => {
const { dbClient } = getDynamoClients(config);
return createDataAccess(
isMigration ? TEST_DA_MIGRATION_CONFIG : TEST_DA_CONFIG,
console,
dbClient,
);
return createDataAccess(TEST_DA_CONFIG, console, dbClient);
};

export { getDynamoClients };

0 comments on commit 439cb8c

Please sign in to comment.