- WIP on SQLite Adapter and migration

This commit is contained in:
mcndave committed 2023-03-27 18:38:31 +00:00
1 parent cee978ecfd
commit 9514a46ae7
14 files changed
+98 -40

No files matched your search

+11 -3
View File
@@ -30,9 +30,12 @@ trait DefaultAdapterTrait
return $this->database;
}
public function schemaTable(ConnectionAdapter $parent, $databaseName, string $tableName) /* : ? object */
public function schemaTable(ConnectionAdapter $adapter, $databaseName, string $tableName) : null|object
{
return Table::repository(Repository::DEFAULT_ALIAS, $parent)->where($this->escapeIdentifier('table_schema', AdapterInterface::IDENTIFIER_FIELD), $databaseName)->loadOneFromField($this->escapeIdentifier('table_name', AdapterInterface::IDENTIFIER_FIELD), $tableName);
return Table::repository(Repository::DEFAULT_ALIAS, $adapter)
->select(\Ulmus\Common\Sql::raw('this.*'))
->where($this->escapeIdentifier('table_schema', AdapterInterface::IDENTIFIER_FIELD), $databaseName)
->loadOneFromField($this->escapeIdentifier('table_name', AdapterInterface::IDENTIFIER_FIELD), $tableName);
}
public function mapFieldType(FieldDefinition $field, bool $typeOnly = false) : string
@@ -92,4 +95,9 @@ trait DefaultAdapterTrait
return $typeOnly ? $type : $type . ( isset($length) ? "($length" . ( ! empty($precision) ? ",$precision" : "" ) . ")" : "" );
}
}
public function whitelistAttributes(array &$parameters) : void
{
$parameters = array_intersect_key($parameters, array_flip(static::ALLOWED_ATTRIBUTES));
}
}