Import SQLite source

This commit is contained in:
1ilit
2024-06-14 01:00:47 +03:00
parent c0584f11c6
commit e61757f93d
7 changed files with 328 additions and 99 deletions

View File

@@ -366,8 +366,8 @@ export const postgresTypes = {
};
export const sqliteTypes = {
INT: {
type: "INT",
INTEGER: {
type: "INTEGER",
checkDefault: (field) => {
return intRegex.test(field.default);
},
@@ -386,23 +386,6 @@ export const sqliteTypes = {
hasPrecision: true,
defaultSize: null,
},
TEXT: {
type: "TEXT",
checkDefault: (field) => false,
hasCheck: false,
isSized: true,
hasPrecision: false,
defaultSize: 65535,
hasQuotes: true,
},
BLOB: {
type: "BLOB",
checkDefault: (field) => false,
isSized: false,
hasCheck: false,
hasPrecision: false,
defaultSize: null,
},
NUMERIC: {
type: "NUMERIC",
checkDefault: (field) => {
@@ -426,6 +409,42 @@ export const sqliteTypes = {
hasPrecision: false,
defaultSize: null,
},
VARCHAR: {
type: "VARCHAR",
checkDefault: (field) => {
if (strHasQuotes(field.default)) {
return field.default.length - 2 <= field.size;
}
return field.default.length <= field.size;
},
hasCheck: true,
isSized: true,
hasPrecision: false,
defaultSize: 255,
hasQuotes: true,
},
TEXT: {
type: "TEXT",
checkDefault: (field) => {
if (strHasQuotes(field.default)) {
return field.default.length - 2 <= field.size;
}
return field.default.length <= field.size;
}, hasCheck: true,
isSized: true,
hasPrecision: false,
defaultSize: 65535,
hasQuotes: true,
},
BLOB: {
type: "BLOB",
checkDefault: (field) => false,
isSized: false,
hasCheck: false,
hasPrecision: false,
defaultSize: null,
},
TIME: {
type: "TIME",
checkDefault: (field) => {