Skip to content

Commit

Permalink
Resolve recursive migration issue that comes up in a particular use c…
Browse files Browse the repository at this point in the history
…ase (#2071)

* Resolve recursive migration that comes up in a particular case

* Remove migration altogether
  • Loading branch information
develohpanda committed Apr 29, 2020
1 parent c7ba218 commit d6bb7a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 50 deletions.
37 changes: 0 additions & 37 deletions packages/insomnia-app/app/models/__tests__/api-spec.test.js

This file was deleted.

15 changes: 2 additions & 13 deletions packages/insomnia-app/app/models/api-spec.js
@@ -1,7 +1,6 @@
// @flow
import type { BaseModel } from './index';
import * as db from '../common/database';
import * as models from './index';

export const name = 'ApiSpec';
export const type = 'ApiSpec';
Expand All @@ -19,14 +18,14 @@ export type ApiSpec = BaseModel & BaseApiSpec;

export function init(): BaseApiSpec {
return {
fileName: '',
fileName: 'Insomnia Designer',
contents: '',
contentType: 'yaml',
};
}

export async function migrate(doc: ApiSpec): Promise<ApiSpec> {
return _migrateFileName(doc);
return doc;
}

export function getByParentId(workspaceId: string): Promise<ApiSpec> {
Expand Down Expand Up @@ -65,13 +64,3 @@ export function update(apiSpec: ApiSpec, patch: $Shape<ApiSpec> = {}): Promise<A
export function removeWhere(parentId: string): Promise<void> {
return db.removeWhere(type, { parentId });
}

async function _migrateFileName(doc: ApiSpec): Promise<ApiSpec> {
if (doc.fileName) {
return doc;
}

const workspace = await models.workspace.getById(doc.parentId);

return { ...doc, fileName: workspace?.name || '' };
}

0 comments on commit d6bb7a3

Please sign in to comment.