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

View File

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

View File

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

View File

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