updates
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type { BUN_MARIADB_FieldSchemaType } from "../../types";
|
||||
import isVectorField from "./is-vector-field";
|
||||
import mapDataType from "./map-data-types";
|
||||
import MariaDBQuoteGen from "./mariadb-quote-gen";
|
||||
|
||||
@@ -16,13 +17,19 @@ export default function buildColumnDefinition(
|
||||
parts.push("AUTO_INCREMENT");
|
||||
}
|
||||
|
||||
if (field.notNullValue || field.primaryKey || field.isVector) {
|
||||
// Vector columns used in VECTOR INDEX must be NOT NULL
|
||||
if (
|
||||
field.notNullValue ||
|
||||
field.primaryKey ||
|
||||
isVectorField(field)
|
||||
) {
|
||||
if (!field.primaryKey) {
|
||||
parts.push("NOT NULL");
|
||||
}
|
||||
}
|
||||
|
||||
if (field.unique && !field.primaryKey) {
|
||||
// VECTOR columns cannot be UNIQUE in the usual sense
|
||||
if (field.unique && !field.primaryKey && !isVectorField(field)) {
|
||||
parts.push("UNIQUE");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user