sqlite_lint: add support for FTS5 and virtual tables
This commit is contained in:
@@ -23,7 +23,10 @@ var Checks = []Check{
|
||||
Explanation: "All columns should be marked as `not null` unless they are foreign keys. (Primary keys are\n" +
|
||||
"automatically not-null, and don't need to be specified.)",
|
||||
Execute: func(s schema.Schema) (ret []CheckResult) {
|
||||
for tablename := range s.Tables {
|
||||
for tablename, tbl := range s.Tables {
|
||||
if tbl.TableType != "table" {
|
||||
continue
|
||||
}
|
||||
for _, column := range s.Tables[tablename].Columns {
|
||||
if !column.IsNotNull && !column.IsForeignKey && !column.IsPrimaryKey {
|
||||
ret = append(ret, CheckResult{
|
||||
@@ -43,7 +46,10 @@ var Checks = []Check{
|
||||
"integer, real, text, blob or any). This disallows all 'date' and 'time' column types.\n" +
|
||||
"See more: https://www.sqlite.org/stricttables.html",
|
||||
Execute: func(s schema.Schema) (ret []CheckResult) {
|
||||
for tablename := range s.Tables {
|
||||
for tablename, tbl := range s.Tables {
|
||||
if tbl.TableType != "table" {
|
||||
continue
|
||||
}
|
||||
if !s.Tables[tablename].IsStrict {
|
||||
ret = append(ret, CheckResult{
|
||||
ErrorMsg: "Table should be marked \"strict\"",
|
||||
@@ -78,7 +84,10 @@ var Checks = []Check{
|
||||
Explanation: "All tables must have a primary key. If it's rowid, it has to be named explicitly.",
|
||||
Execute: func(s schema.Schema) (ret []CheckResult) {
|
||||
tableloop:
|
||||
for tablename := range s.Tables {
|
||||
for tablename, tbl := range s.Tables {
|
||||
if tbl.TableType != "table" {
|
||||
continue
|
||||
}
|
||||
for _, column := range s.Tables[tablename].Columns {
|
||||
if column.IsPrimaryKey {
|
||||
continue tableloop
|
||||
@@ -161,6 +170,9 @@ var Checks = []Check{
|
||||
Execute: func(s schema.Schema) (ret []CheckResult) {
|
||||
tbl_loop:
|
||||
for tblName, tbl := range s.Tables {
|
||||
if tbl.TableType != "table" {
|
||||
continue
|
||||
}
|
||||
if tbl.IsWithoutRowid {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user