@@ -5,3 +5,73 @@ sidebar:
55 order : 50
66---
77
8+ Compliance with the rules in the dbLinter repository can be verified using checks, SQL-based tests, or both.
9+ In a SQL-based test, an SQL query is run against a non-production database via a configured read-only connection.
10+ The returned rows are treated as violations of the rule.
11+ Optionally, each return row may contain a migration script to fix the violation.
12+
13+ ## Prerequisites
14+
15+ In order to run SQL-based tests, you must first configure [ read-only access] ( /dbLinter/tools/vscode/settings/#read-only-access ) .
16+
17+ ## Applicability
18+
19+ Whether a SQL-based test is shown in the VS Code extension depends on the following:
20+
21+ 1 . Is the rule enabled in the configuration?
22+ 2 . Does the database version fall within the minimal and maximal ranges defined in the rule?
23+
24+ The SQL-based test is only considered applicable if both questions can be answered with 'yes'.
25+
26+ ## Activation
27+
28+ The applicable SQL-based tests are determined when a check is activated or when you open the dbLinter view container.
29+ The dbLinter view container is the dbLinter symbol
30+
31+ ![ dbLinter symbol] ( ../../../../assets/logo/dbLinter-icon-color.svg )
32+
33+ on the activity bar. ` SQL-based Tests ` is the first view in this container.
34+
35+ ![ Tests Activated] ( ../../../../assets/images/vscode/vscode-tests-activated.png )
36+
37+ ## Run Tests
38+
39+ To run all tests, right-click anywhere in the view and select ` Run All Tests ` .
40+ To run selected tests, right-click on one of the selected tests and select the ` Run Test ` option.
41+ Alternatively, click the run button to the right of each test.
42+
43+ ![ Run Selected Tests] ( ../../../../assets/images/vscode/vscode-tests-run-selected.png )
44+
45+ The found rule violations are visualised as children in the tree.
46+
47+ ![ Test Results] ( ../../../../assets/images/vscode/vscode-tests-run-selected-result.png )
48+
49+ ## Ignore Test Results
50+
51+ If you are unable to resolve a rule violation reported by an SQL-based test, or if you choose not to, you can ignore selected test results.
52+ This ensures that the rule violations will not appear in subsequent test runs.
53+
54+ To perform this action, your access token must have either the ` Configurator ` or ` Tenant-Admin ` role.
55+
56+ ![ Ignore Test Results] ( ../../../../assets/images/vscode/vscode-tests-ignore-test-results.png )
57+
58+ After selecting the test results to be ignored, you must provide a reason why these results should be excluded from future runs.
59+
60+ ![ Ignore Test Result Reason] ( ../../../../assets/images/vscode/vscode-tests-ignore-test-results-reason-dialog.png )
61+
62+ You can manage the test results to be ignored in the Web GUI.
63+
64+ ![ Ignore Test Results in Web GUI] ( ../../../../assets/images/vscode/vscode-tests-ignore-test-results-in-web-gui.png )
65+
66+ ## Migration Scripts
67+
68+ If the SQL-based test produces a migration script, you can show it in a new editor tab.
69+
70+ ![ Show Migration Script] ( ../../../../assets/images/vscode/vscode-tests-show-migration-script.png )
71+
72+ The following migration script is shown in this case:
73+
74+ ![ Generated Migration Script] ( ../../../../assets/images/vscode/vscode-tests-generated-migration-script.png )
75+
76+ The SQL-based test for [ G-1240: Try to index foreign key columns] ( https://dblinter.app/ords/r/dblinter/dblinter-console/rules#P1000_SHOW_RULE=core%20g-1240 ) uses the [ IF NOT EXISTS] ( https://docs.oracle.com/en/database/oracle/oracle-database/26/sqlrf/CREATE-INDEX.html#GUID-1F89BBC0-825F-4215-AF71-7588E31D8BFE__GUID-9F542E6F-CC27-40D6-BC54-487C44E68844 ) clause only if applicable to the used database version.
77+
0 commit comments