trail / db
Database addon for trail
0.3.2
2026-10-05 05:05 UTC
Requires
- php: >=8.4
- ext-pdo: *
- trail/framework: ^0.3
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Database addon for trail framework
install
composer require trail/db
run migrations
trail/trail db::migrate
write migrations
Theres a helper at $database->id() which gives an auto increment primary key for the db engine. made it easier for me
return static function (Connection $database): void {
$database->run("
create table notes (
id {$database->id()},
body text not null
)
");
};
checkpoint (sqlite)
trail/trail db::checkpoint
sqlite runs with a persistent connection, so writes sit in db.sqlite-wal till they get added to the db. Run this before copying db file anywhere to make sure its updated
Notes
Only supports sqlite atm. postgres + mysql to come