Fix indexing off not working for SQL and graph free tier accounts (#85)

This commit is contained in:
victor-meng 2020-07-13 10:54:59 -07:00 committed by GitHub
parent 15f9146ac9
commit 15953da51e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 0 deletions

View File

@ -553,6 +553,7 @@ export interface GraphParameters extends RpParameters {
pk: string;
coll: string;
cd: Boolean;
indexingPolicy?: IndexingPolicy;
}
export interface CreationRequest {
@ -570,6 +571,7 @@ export interface SqlCollectionParameters extends RpParameters {
coll: string;
cd: Boolean;
analyticalStorageTtl?: number;
indexingPolicy?: IndexingPolicy;
}
export interface MongoCreationRequest extends CreationRequest {
@ -588,6 +590,7 @@ export interface GraphCreationRequest extends CreationRequest {
resource: {
id: string;
partitionKey: {};
indexingPolicy?: IndexingPolicy;
};
options: RpOptions;
};
@ -613,6 +616,7 @@ export interface SqlCollectionCreationRequest extends CreationRequest {
id: string;
partitionKey: {};
analyticalStorageTtl?: number;
indexingPolicy?: IndexingPolicy;
};
options: RpOptions;
};

View File

@ -889,6 +889,7 @@ export default class AddCollectionPane extends ContextualPaneBase implements Vie
this.container.armEndpoint(),
databaseId,
collectionId,
indexingPolicy,
offerThroughput,
partitionKeyPath,
partitionKey.version,
@ -908,6 +909,7 @@ export default class AddCollectionPane extends ContextualPaneBase implements Vie
databaseId,
this._getAnalyticalStorageTtl(),
collectionId,
indexingPolicy,
offerThroughput,
partitionKeyPath,
partitionKey.version,

View File

@ -1,3 +1,4 @@
import * as SharedConstants from "../Shared/Constants";
import { AddDbUtilities } from "../Shared/AddDatabaseUtility";
import { CreateCollectionUtilities, CreateSqlCollectionUtilities, Utilities } from "./AddCollectionUtility";
jest.mock("AddDatabaseUtility");
@ -19,6 +20,7 @@ describe("Add Collection Utitlity", () => {
rg: "b1",
st: true,
defaultTtl: -1,
indexingPolicy: SharedConstants.IndexingPolicies.AllPropertiesIndexed,
partitionKeyVersion: 2
};
const additionalOptions = {};
@ -28,6 +30,7 @@ describe("Add Collection Utitlity", () => {
properties.db,
properties.defaultTtl,
properties.coll,
properties.indexingPolicy,
properties.offerThroughput,
properties.pk,
properties.partitionKeyVersion,
@ -55,6 +58,7 @@ describe("Add Collection Utitlity", () => {
rg: "b1",
st: true,
analyticalStorageTtl: -1,
indexingPolicy: SharedConstants.IndexingPolicies.AllPropertiesIndexed,
partitionKeyVersion: 2
};
const additionalOptions = {};
@ -65,6 +69,7 @@ describe("Add Collection Utitlity", () => {
properties.db,
properties.analyticalStorageTtl,
properties.coll,
properties.indexingPolicy,
properties.offerThroughput,
properties.pk,
properties.partitionKeyVersion,
@ -95,6 +100,7 @@ describe("Add Collection Utitlity", () => {
sid: "a1",
rg: "b1",
st: true,
indexingPolicy: SharedConstants.IndexingPolicies.AllPropertiesIndexed,
partitionKeyVersion: 2
};
const additionalOptions = {};
@ -103,6 +109,7 @@ describe("Add Collection Utitlity", () => {
armEndpoint,
properties.db,
properties.coll,
properties.indexingPolicy,
properties.offerThroughput,
properties.pk,
properties.partitionKeyVersion,
@ -127,6 +134,7 @@ describe("Add Collection Utitlity", () => {
sid: "a1",
rg: "b1",
st: true,
indexingPolicy: SharedConstants.IndexingPolicies.AllPropertiesIndexed,
partitionKeyVersion: 2
};
const additionalOptions = {};
@ -136,6 +144,7 @@ describe("Add Collection Utitlity", () => {
armEndpoint,
properties.db,
properties.coll,
properties.indexingPolicy,
properties.offerThroughput,
properties.pk,
properties.partitionKeyVersion,

View File

@ -18,6 +18,7 @@ export class CreateSqlCollectionUtilities {
databaseId: string,
analyticalStorageTtl: number,
collectionId: string,
indexingPolicy: DataModels.IndexingPolicy,
offerThroughput: number,
partitionKey: string,
partitionKeyVersion: number,
@ -41,6 +42,7 @@ export class CreateSqlCollectionUtilities {
rg,
dba,
analyticalStorageTtl,
indexingPolicy,
partitionKeyVersion
};
@ -75,6 +77,10 @@ export class CreateSqlCollectionUtilities {
rpPayloadToCreateCollection.properties.resource.analyticalStorageTtl = params.analyticalStorageTtl;
}
if (params.indexingPolicy) {
rpPayloadToCreateCollection.properties.resource.indexingPolicy = params.indexingPolicy;
}
if (!params.st) {
if (rpOptions) {
rpPayloadToCreateCollection.properties.options = rpOptions;
@ -117,6 +123,7 @@ export class CreateCollectionUtilities {
armEndpoint: string,
databaseId: string,
collectionId: string,
indexingPolicy: DataModels.IndexingPolicy,
offerThroughput: number,
partitionKey: string,
partitionKeyVersion: number,
@ -137,6 +144,7 @@ export class CreateCollectionUtilities {
sid,
rg,
dba,
indexingPolicy,
partitionKeyVersion
};
@ -167,6 +175,10 @@ export class CreateCollectionUtilities {
}
};
if (params.indexingPolicy) {
rpPayloadToCreateCollection.properties.resource.indexingPolicy = params.indexingPolicy;
}
if (!params.st) {
if (rpOptions) {
rpPayloadToCreateCollection.properties.options = rpOptions;