Skip to content

Commit

Permalink
Update schema introspection to work with latest multirange updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jaclarke committed Aug 22, 2023
1 parent 4322287 commit 61f295e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions shared/common/schemaData/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,8 @@ export function buildTypesGraph(data: RawIntrospectionResult): {
name: type.name,
} as any);
break;
case "schema::Multirange":
case "schema::MultirangeExprAlias":
case "schema::MultiRange":
case "schema::MultiRangeExprAlias":
types.set(type.id, {
schemaType: "Multirange",
id: type.id,
Expand Down Expand Up @@ -745,8 +745,8 @@ export function buildTypesGraph(data: RawIntrospectionResult): {
}
case "schema::Range":
case "schema::RangeExprAlias":
case "schema::Multirange":
case "schema::MultirangeExprAlias": {
case "schema::MultiRange":
case "schema::MultiRangeExprAlias": {
const elementType = types.get(type.range_element_type_id!);
if (!elementType) {
throw new Error(
Expand Down
5 changes: 3 additions & 2 deletions shared/common/schemaData/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ select Type {
).id,
constraintIds := [is ConsistencySubject].constraints.id,
element_type_id := [is Array].element_type.id,
range_element_type_id := [is Range].element_type.id
?? [is Multirange].element_type.id,
range_element_type_id := [is Range].element_type.id${
versionGTE(version, [4, 0]) ? ` ?? [is MultiRange].element_type.id` : ""
},
[is Tuple].element_types: {
name,
type_id := .type.id,
Expand Down
6 changes: 3 additions & 3 deletions shared/studio/state/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import {SessionState, sessionStateCtx} from "./sessionState";

export const dbCtx = createMobxContext<DatabaseState>();

const SCHEMA_DATA_VERSION = 6;
const SCHEMA_DATA_VERSION = 7;

export interface StoredSchemaData {
version: number;
Expand Down Expand Up @@ -239,8 +239,8 @@ export class DatabaseState extends Model({
conn
.query(
getIntrospectionQuery([
schemaInfo.version.major,
schemaInfo.version.minor,
Number(schemaInfo.version.major),
Number(schemaInfo.version.minor),
])
)
.then(({result}) => {
Expand Down

0 comments on commit 61f295e

Please sign in to comment.