@balena/abstract-sql-compiler
Advanced tools
Comparing version 7.8.2-fix-schema-optimizations-bb989d17aa9308aa6bfba56065cff391d0023608 to 7.8.2
{ | ||
"name": "@balena/abstract-sql-compiler", | ||
"version": "7.8.2-fix-schema-optimizations-bb989d17aa9308aa6bfba56065cff391d0023608", | ||
"version": "7.8.2", | ||
"description": "A translator for abstract sql into sql.", | ||
@@ -5,0 +5,0 @@ "main": "out/AbstractSQLCompiler.js", |
@@ -173,1 +173,74 @@ import * as AbstractSQLCompiler from '../..'; | ||
}); | ||
it('should work with differing table/resource names', () => { | ||
expect( | ||
generateSchema({ | ||
synonyms: {}, | ||
relationships: {}, | ||
tables: { | ||
some_other_resource_name: { | ||
name: 'test', | ||
resourceName: 'some_other_resource_name', | ||
idField: 'id', | ||
fields: [ | ||
{ | ||
fieldName: 'id', | ||
dataType: 'Integer', | ||
index: 'PRIMARY KEY', | ||
}, | ||
], | ||
indexes: [], | ||
primitive: false, | ||
}, | ||
}, | ||
rules: [ | ||
[ | ||
'Rule', | ||
[ | ||
'Body', | ||
[ | ||
'Not', | ||
[ | ||
'Exists', | ||
[ | ||
'SelectQuery', | ||
['Select', []], | ||
['From', ['test', 'test.0']], | ||
[ | ||
'Where', | ||
[ | ||
'Not', | ||
[ | ||
'And', | ||
[ | ||
'LessThan', | ||
['Integer', 0], | ||
['ReferencedField', 'test.0', 'id'], | ||
], | ||
['Exists', ['ReferencedField', 'test.0', 'id']], | ||
], | ||
], | ||
], | ||
], | ||
], | ||
], | ||
] as AbstractSQLCompiler.AbstractSqlQuery, | ||
[ | ||
'StructuredEnglish', | ||
'It is necessary that each test has an id that is greater than 0.', | ||
], | ||
], | ||
], | ||
}), | ||
) | ||
.to.have.property('createSchema') | ||
.that.deep.equals([ | ||
`\ | ||
CREATE TABLE IF NOT EXISTS "test" ( | ||
"id" INTEGER NULL PRIMARY KEY | ||
, -- It is necessary that each test has an id that is greater than 0. | ||
CONSTRAINT "test$hkEwz3pzAqalNu6crijhhdWJ0ffUvqRGK8rMkQbViPg=" CHECK (0 < "id" | ||
AND "id" IS NOT NULL) | ||
);`, | ||
]); | ||
}); |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
583801
12893
1