- WIP on Alter table for lean-console

This commit is contained in:
mcndave committed 2023-03-30 15:24:48 +00:00
1 parent 9514a46ae7
commit 2ad52aba85
11 files changed
+63 -11

No files matched your search

+9 -3
View File
@@ -3,8 +3,8 @@
namespace Ulmus\Entity\Sqlite;
use Ulmus\EntityCollection;
use Ulmus\{Attribute\Obj\Table};
use Ulmus\Query\{From, Select};
use Ulmus\{Attribute\Obj\Table, Repository};
use Ulmus\Attribute\Property\{Field, Filter, FilterJoin, Relation, Join, Virtual, Where};
#[Table(name: "sqlite_master")]
@@ -27,6 +27,12 @@ class Schema
#[Field]
public ? string $sql;
#[Relation("oneToMany", key: "tableName", foreignKey: "tableName", entity: Column::class)]
##[Relation("oneToMany", key: "tableName", foreignKey: "tableName", entity: Column::class)]
#[Virtual(method: "filterColumns")]
public EntityCollection $columns;
public function filterColumns() : EntityCollection
{
return ( new Repository\SqliteRepository(Column::class) )->pragma('table_info', $this->tableName)->collectionFromQuery();
}
}
+1
View File
@@ -5,6 +5,7 @@ namespace Ulmus\Entity\Sqlite;
use Ulmus\ConnectionAdapter;
use Ulmus\Repository;
#[\Ulmus\Attribute\Obj\Table(name: "sqlite_master")]
class Table extends Schema
{
public static function repository(string $alias = Repository::DEFAULT_ALIAS, ConnectionAdapter $adapter = null): Repository