Size restrictions for text/binary/numeric types #9

Closed
opened 2026-08-02 14:47:58 +02:00 by c.fahner · 1 comment
Owner

Currently databases have to declare string and int types using the maximum size available to them.

The String_ and Int_ types should be made public, be declarable as attributes, and introduce a "max length" property. The String_ type should enforce a default max length (breaking change!) and also keep supporting infinite length (use the INF constant, since it is clearer than having a 0 sentinel value).

The Schema class should be changed to accomodate types being declared as attributes, which override the PHP-declared type.

The same should be done for the Blob type, if #7 is implemented by then.

Update:
Separate the namespaces: Slendium\Ocd\Schema\Types contains type implementations and Slendium\Ocd\Schema\Type contains additional interfaces for types to optionally support.

An interface Type\Sized would be implemented by the string and int types.

Currently databases have to declare `string` and `int` types using the maximum size available to them. The `String_` and `Int_` types should be made public, be declarable as attributes, and introduce a "max length" property. The `String_` type should enforce a default max length (breaking change!) and also keep supporting infinite length (use the `INF` constant, since it is clearer than having a `0` sentinel value). The `Schema` class should be changed to accomodate types being declared as attributes, which override the PHP-declared type. The same should be done for the `Blob` type, if #7 is implemented by then. **Update**: Separate the namespaces: `Slendium\Ocd\Schema\Types` contains type **implementations** and `Slendium\Ocd\Schema\Type` contains additional interfaces for types to optionally support. An interface `Type\Sized` would be implemented by the string and int types.
c.fahner added this to the v0.2 milestone 2026-08-20 19:51:30 +02:00
c.fahner added spent time 2026-09-22 16:16:52 +02:00
30 minutes
c.fahner stopped working 2026-09-22 17:05:20 +02:00
48 minutes 23 seconds
c.fahner stopped working 2026-09-22 19:42:34 +02:00
1 hour 5 minutes
Author
Owner

Decided not to use INF and stick to finite sizes for now.

Decided not to use `INF` and stick to finite sizes for now.
c.fahner changed title from Size restrictions for string/int types to Size restrictions for text/binary/numeric types 2026-09-22 19:44:50 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Total time spent: 2 hours 23 minutes
c.fahner
2 hours 23 minutes
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
slendium/ocd#9
No description provided.