Skip to content

Commit

Permalink
Implementado validacao de tabela sem PK.
Browse files Browse the repository at this point in the history
  • Loading branch information
Anderson Bestteti Santos committed Jan 17, 2019
1 parent cfdd4d2 commit 17c4a1c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,9 @@ checkFKColumns(index);]]>
<![CDATA[]]>
</script>
</scr>
<scr id="B0F0E2CA-6F41-463F-73A0-17FB99716AC6" name="TJRS - Tables without primary key" object="Table" engine="Oracle Nashorn" type="Error" var="table" library="TJRS lib" method="tableWithOutPK" purpose="validation" >
<script>
<![CDATA[]]>
</script>
</scr>
</custom__validation_scripts>
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ return true
end]]>
</script>
</lib>
<lib id="79C2ED6C-9A18-434F-F0FE-838F87B60814" name="TJRS lib" engine="Oracle Nashorn" methods="versaoBiblioteca,indexWithInvalidName,FKWithOutIndex,createIndexOnFK,normalizeIndexName" >
<lib id="79C2ED6C-9A18-434F-F0FE-838F87B60814" name="TJRS lib" engine="Oracle Nashorn" methods="versaoBiblioteca,indexWithInvalidName,FKWithOutIndex,createIndexOnFK,normalizeIndexName,tableWithOutPK" >
<script>
<![CDATA[// Variable used to return custom message
var ruleMessage;
Expand All @@ -86,7 +86,7 @@ var errType;
/*============================================================================*/
function versaoBiblioteca() {
var versao = "Versão: 1.0.21.11.2018";
var versao = "Versão: 1.0.17.01.2019";
var titulo = "TJRS - Biblioteca de scripts";
javax.swing.JOptionPane
Expand Down Expand Up @@ -354,7 +354,40 @@ function normalizeIndexName() {
}
}
}
}]]>
}
/*============================================================================*/
/**
* This Design rule aims to spot table which
* have no primary key.
*
* Parameters
* table: a given table object
* Returns
* Boolean. True if the design rule is satisfied,
* otherwise False.
*/
function tableWithOutPK(table) {
// Stores the result of this custom
// design rule.
result = true;
// Try to retrieve the table's PK.
pk = table.getPK();
if (pk == null) {
ruleMessage = "there is no primary key for this table.";
errType = "Error";
result = false;
}
return result;
}
/*============================================================================*/
]]>
</script>
</lib>
</custom_libraries>

0 comments on commit 17c4a1c

Please sign in to comment.