Skip to content

Commit

Permalink
Support multiranges in schema + update ui test workflow (#224)
Browse files Browse the repository at this point in the history
* Support multiranges in schema

* Use setup-chromedriver@v2

* Use edgedb nightly
  • Loading branch information
jaclarke authored Aug 14, 2023
1 parent e73821d commit e1c7d77
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ui_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ jobs:
- name: Install EdgeDB
uses: edgedb/setup-edgedb@v1
with:
server-version: 3.0-rc.1
server-version: nightly

- name: Set up chrome
uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable

- name: Set up chromedriver
uses: nanasess/setup-chromedriver@v1
uses: nanasess/setup-chromedriver@v2

- name: Install dev deps
working-directory: web
Expand Down
29 changes: 27 additions & 2 deletions shared/common/schemaData/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ export interface SchemaRangeType {
elementType: SchemaType;
}

export interface SchemaMultirangeType {
schemaType: "Multirange";
id: string;
name: string;
escapedName: string;
elementType: SchemaType;
}

interface _SchemaPointer {
schemaType: "Pointer";
id: string;
Expand Down Expand Up @@ -158,6 +166,7 @@ export type SchemaType =
| SchemaArrayType
| SchemaTupleType
| SchemaRangeType
| SchemaMultirangeType
| SchemaObjectType;

export interface SchemaParam {
Expand Down Expand Up @@ -386,6 +395,14 @@ export function buildTypesGraph(data: RawIntrospectionResult): {
name: type.name,
} as any);
break;
case "schema::Multirange":
case "schema::MultirangeExprAlias":
types.set(type.id, {
schemaType: "Multirange",
id: type.id,
name: type.name,
} as any);
break;
case "schema::ObjectType":
types.set(type.id, {
schemaType: "Object",
Expand Down Expand Up @@ -727,7 +744,9 @@ export function buildTypesGraph(data: RawIntrospectionResult): {
break;
}
case "schema::Range":
case "schema::RangeExprAlias": {
case "schema::RangeExprAlias":
case "schema::Multirange":
case "schema::MultirangeExprAlias": {
const elementType = types.get(type.range_element_type_id!);
if (!elementType) {
throw new Error(
Expand Down Expand Up @@ -824,7 +843,8 @@ export function buildTypesGraph(data: RawIntrospectionResult): {
if (
type.schemaType === "Array" ||
type.schemaType === "Tuple" ||
type.schemaType === "Range"
type.schemaType === "Range" ||
type.schemaType === "Multirange"
) {
const [name, escapedName] = getNameOfSchemaType(type);
type.name = name;
Expand Down Expand Up @@ -909,6 +929,11 @@ export function getNameOfSchemaType(type: SchemaType): [string, string] {
`range<${type.elementType.name}>`,
`range<${type.elementType.escapedName}>`,
];
case "Multirange":
return [
`multirange<${type.elementType.name}>`,
`multirange<${type.elementType.escapedName}>`,
];
default:
throw new Error(`unknown schema type: ${(type as any).schemaType}`);
}
Expand Down
3 changes: 2 additions & 1 deletion shared/common/schemaData/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ 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,
range_element_type_id := [is Range].element_type.id
?? [is Multirange].element_type.id,
[is Tuple].element_types: {
name,
type_id := .type.id,
Expand Down
2 changes: 1 addition & 1 deletion 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 = 5;
const SCHEMA_DATA_VERSION = 6;

export interface StoredSchemaData {
version: number;
Expand Down

0 comments on commit e1c7d77

Please sign in to comment.