mirror of https://github.com/AMT-Cheif/drift.git
Version check for new joins
This commit is contained in:
parent
098fcc2d1b
commit
a6b7bf9aaa
|
@ -276,6 +276,21 @@ class LintingVisitor extends RecursiveVisitor<void, void> {
|
||||||
visitChildren(e, arg);
|
visitChildren(e, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void visitJoinOperator(JoinOperator e, void arg) {
|
||||||
|
if ((e.operator == JoinOperatorKind.right ||
|
||||||
|
e.operator == JoinOperatorKind.full) &&
|
||||||
|
options.version < SqliteVersion.v3_39) {
|
||||||
|
context.reportError(
|
||||||
|
AnalysisError(
|
||||||
|
type: AnalysisErrorType.notSupportedInDesiredVersion,
|
||||||
|
message: '`RIGHT` and `FULL` joins require sqlite 3.39.',
|
||||||
|
relevantNode: e,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void visitRaiseExpression(RaiseExpression e, void arg) {
|
void visitRaiseExpression(RaiseExpression e, void arg) {
|
||||||
if (_isTopLevelStatement) {
|
if (_isTopLevelStatement) {
|
||||||
|
|
|
@ -118,4 +118,17 @@ void main() {
|
||||||
currentEngine.analyze(sql).expectNoError();
|
currentEngine.analyze(sql).expectNoError();
|
||||||
currentEngine.analyze(notSql).expectNoError();
|
currentEngine.analyze(notSql).expectNoError();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('warns about right and full joins', () {
|
||||||
|
const right = 'SELECT * FROM demo RIGHT JOIN demo';
|
||||||
|
const full = 'SELECT * FROM demo NATURAL FULL JOIN demo';
|
||||||
|
|
||||||
|
minimumEngine.analyze(right).expectError('RIGHT JOIN',
|
||||||
|
type: AnalysisErrorType.notSupportedInDesiredVersion);
|
||||||
|
minimumEngine.analyze(full).expectError('NATURAL FULL JOIN',
|
||||||
|
type: AnalysisErrorType.notSupportedInDesiredVersion);
|
||||||
|
|
||||||
|
currentEngine.analyze(right).expectNoError();
|
||||||
|
currentEngine.analyze(full).expectNoError();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue