feat(server)!: pgvecto.rs 0.2 and pgvector compatibility (#6785)
* basic changes update version check set ef_search for clip * pgvector compatibility Revert "pgvector compatibility" This reverts commit 2b66a52aa4097dd27da58138c5288fd87cb9b24a. pgvector compatibility: minimal edition pgvector startup check * update extension at startup * wording shortened vector extension variable name * nightly docker * fixed version checks * update tests add tests for updating extension remove unnecessary check * simplify `getRuntimeConfig` * wording * reindex on minor version update * 0.2 upgrade testing update prod compose * acquire lock for init * wip vector down on shutdown * use upgrade helper * update image tag * refine restart check check error message * test reindex testing upstream fix formatting fixed reindexing * use enum in signature * fix tests remove unused code * add reindexing tests * update to official 0.2 remove alpha from version name * add warning test if restart required * update test image to 0.2.0 * linting and test cleanup * formatting * update sql * wording * handle setting search path for new and existing databases * handle new db in reindex check * fix post-update reindexing * get dim size * formatting * use vbase * handle different db name * update sql * linting * fix suggested env
This commit is contained in:
@@ -12,11 +12,20 @@ export interface IVersion {
|
||||
patch: number;
|
||||
}
|
||||
|
||||
export enum VersionType {
|
||||
EQUAL = 0,
|
||||
PATCH = 1,
|
||||
MINOR = 2,
|
||||
MAJOR = 3,
|
||||
}
|
||||
|
||||
export class Version implements IVersion {
|
||||
public readonly types = ['major', 'minor', 'patch'] as const;
|
||||
|
||||
constructor(
|
||||
public readonly major: number,
|
||||
public readonly minor: number = 0,
|
||||
public readonly patch: number = 0,
|
||||
public major: number,
|
||||
public minor: number = 0,
|
||||
public patch: number = 0,
|
||||
) {}
|
||||
|
||||
toString() {
|
||||
@@ -39,27 +48,30 @@ export class Version implements IVersion {
|
||||
}
|
||||
}
|
||||
|
||||
compare(version: Version): number {
|
||||
for (const key of ['major', 'minor', 'patch'] as const) {
|
||||
private compare(version: Version): [number, VersionType] {
|
||||
for (const [i, key] of this.types.entries()) {
|
||||
const diff = this[key] - version[key];
|
||||
if (diff !== 0) {
|
||||
return diff > 0 ? 1 : -1;
|
||||
return [diff > 0 ? 1 : -1, (VersionType.MAJOR - i) as VersionType];
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return [0, VersionType.EQUAL];
|
||||
}
|
||||
|
||||
isOlderThan(version: Version): boolean {
|
||||
return this.compare(version) < 0;
|
||||
isOlderThan(version: Version): VersionType {
|
||||
const [bool, type] = this.compare(version);
|
||||
return bool < 0 ? type : VersionType.EQUAL;
|
||||
}
|
||||
|
||||
isEqual(version: Version): boolean {
|
||||
return this.compare(version) === 0;
|
||||
const [bool] = this.compare(version);
|
||||
return bool === 0;
|
||||
}
|
||||
|
||||
isNewerThan(version: Version): boolean {
|
||||
return this.compare(version) > 0;
|
||||
isNewerThan(version: Version): VersionType {
|
||||
const [bool, type] = this.compare(version);
|
||||
return bool > 0 ? type : VersionType.EQUAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user