Add docs link, misc format tweaks
This commit is contained in:
@@ -27,7 +27,7 @@ class Definition
|
||||
{
|
||||
$dataType = match (Configuration::mode('make create table statement')) {
|
||||
Mode::PgSQL => 'JSONB',
|
||||
Mode::SQLite => 'TEXT'
|
||||
Mode::SQLite => 'TEXT',
|
||||
};
|
||||
return "CREATE TABLE IF NOT EXISTS $name (data $dataType NOT NULL)";
|
||||
}
|
||||
@@ -91,7 +91,7 @@ class Definition
|
||||
[, $tbl] = self::splitSchemaAndTable($tableName);
|
||||
$extraOps = match ($indexType) {
|
||||
DocumentIndex::Full => '',
|
||||
DocumentIndex::Optimized => ' jsonb_path_ops'
|
||||
DocumentIndex::Optimized => ' jsonb_path_ops',
|
||||
};
|
||||
return "CREATE INDEX IF NOT EXISTS idx_{$tbl}_document ON $tableName USING GIN (data$extraOps)";
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class Patch
|
||||
{
|
||||
$setValue = match (Configuration::mode('make patch statement')) {
|
||||
Mode::PgSQL => 'data || :data',
|
||||
Mode::SQLite => 'json_patch(data, json(:data))'
|
||||
Mode::SQLite => 'json_patch(data, json(:data))',
|
||||
};
|
||||
return "UPDATE $tableName SET data = $setValue WHERE $whereClause";
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class RemoveFields
|
||||
Mode::PgSQL => "UPDATE $tableName SET data = data - " . array_keys($parameters)[0]
|
||||
. "::text[] WHERE $whereClause",
|
||||
Mode::SQLite => "UPDATE $tableName SET data = json_remove(data, " . implode(', ', array_keys($parameters))
|
||||
. ") WHERE $whereClause"
|
||||
. ") WHERE $whereClause",
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user