phorm_annotations 1.4.2
phorm_annotations: ^1.4.2 copied to clipboard
Annotation library for declarative SQL table and schema definitions in Dart. Designed to be used with code generators that produce SQL schemas, migrations, or runtime metadata.
Changelog #
1.4.2 #
- Docs: show how to do CRUD with
generateFullService: false— registerusersTableand resolvedb.service<User>()(aPhormCore<User>). No code changes.
1.4.1 #
- Docs: clarify how to choose a column's SQL type —
type:(typedSqlType) →sqlType:(raw string) →converter:(complex objects) → inferred — and that the deprecatedSqlTypesconstants should no longer be used (README + guides). No code changes.
1.4.0 #
- Deprecate the
SqlTypesstring-constant class (SqlTypes.text, …). Use the typedSqlTypehierarchy via@Column(type: ...)(e.g.TEXT(),VARCHAR(255)), or a raw@Column(sqlType: '...')string for exotic DDL.SqlTypeswill be removed in a future release. - Add
topicstopubspec.yamlfor pub.dev discoverability.
1.3.0 #
- Added
createPivotto@ManyToMany(defaults tofalse). Whentrue, the code generator emits aCREATE TABLE IF NOT EXISTSfor the pivot table automatically (two foreign-key columns plus a composite primary key), so it no longer has to be created manually. - Added
pivotForeignKeysto@ManyToMany(defaults tofalse). When used together withcreatePivot, the generated pivot table also includesFOREIGN KEY (...) REFERENCES ... ON DELETE CASCADEconstraints for both columns.
1.2.0 #
- Added
generateFullServiceto@Schema(defaults totrue). When set tofalse, the generator skips the large pluralized static service class (e.g.Users, with the full CRUD/query API and column constants) and emits only the lightweight artefacts (schema, table,fromJson/toJson,copyWith). Fully backward compatible — existing models are unaffected.
1.1.2 #
- Fixed
MigrationBuilder.build()dropping thecolumns,timestamps, andautoIncrementfields when rebuilding theTable. The lostcolumnsproduced empty relationship JSON aggregation (broken serialization of eager-loaded relations), and a resettimestampsflag causedcreated_at/updated_atto be injected for tables that disabled timestamps. These fields are now carried over from the source table.
1.1.1 #
- Documentation only: documented the
@Schema(dialect: ...)option, the@Column(type: ...)typed SQL types, and the dialect-organisedSqlTypehierarchy in the README. No API changes.
1.1.0 #
- Added
SqlDialectKindenum (sqlite,postgres,mysql) and adialectfield on@Schemaso the generator knows which database flavour to emit DDL for (defaults toSqlDialectKind.sqlite, fully backward compatible). - Reorganised SQL types by dialect under
src/sql_types/(common_types,sqlite_types,postgres_types,mysql_types).src/sql_types.dartis now a barrel re-exporting them, so existing type names (VARCHAR,JSONB,Collate,SqlTypes, …) are unchanged.
1.0.3 #
- Version bump to keep all PHORM packages in sync.
1.0.2 #
- Updated SDK environment constraint to >=3.7.0 <4.0.0
1.0.1 #
- Changed license to MIT
- Updated README with badges
- Removed commented workspace resolution configuration
1.0.0 #
- First stable release.
- Table schema annotations:
@Schema,@Column,@ID. - Database relationship annotations:
@HasMany,@HasOne,@BelongsTo,@ManyToMany, and@Join. - Support for customizable naming strategies, indexes, and custom JSON serialization options.
- Declarative CHECK validators (e.g.
NotEmptyValidator,EmailValidator). - Support for database-independent logical types mapping.
- Added
ValueConverter<D, S>for custom Dart-to-SQL type mappings. - Added test and seed utilities (
Factory<T>andSeederinterfaces).