-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic attibute for related primary key #243
base: main
Are you sure you want to change the base?
Conversation
…imary-key � Conflicts: � src/Database/Database.php
@@ -1082,6 +1082,9 @@ protected function getSQLType(string $type, int $size, bool $signed = true): str | |||
|
|||
return "VARCHAR({$size})"; | |||
|
|||
case Database::VAR_ID: | |||
return 'INT UNSIGNED'; // Same as Primary Key Sqlite does not allow INT(11) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this INT(11)
and override for SQLite?
@@ -253,6 +253,10 @@ public function isValid($document): bool | |||
$validator = new Integer(); | |||
break; | |||
|
|||
case Database::VAR_ID: | |||
$validator = new Text(24, min: 0); // Mongo Id length |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be 36 for non-mongo adapters 🤔 how can we handle both?
Added an Asana task in the backlog |
Co-authored-by: Jake Barnby <jakeb994@gmail.com>
Database::VAR_ID
Since some adapters primary key is a string and some is an int , we need a dynamic ID field per adapter