Skip to content
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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Conversation

fogelito
Copy link
Contributor

@fogelito fogelito commented Mar 6, 2023

Database::VAR_ID
Since some adapters primary key is a string and some is an int , we need a dynamic ID field per adapter

@@ -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)
Copy link
Member

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?

src/Database/Database.php Outdated Show resolved Hide resolved
@@ -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
Copy link
Member

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?

@fogelito
Copy link
Contributor Author

fogelito commented Aug 1, 2023

Added an Asana task in the backlog
Or do we want to to merge this ? :)

@fogelito fogelito closed this Aug 1, 2023
@fogelito fogelito reopened this Aug 1, 2023
@fogelito fogelito requested a review from abnegate August 1, 2023 10:38
Co-authored-by: Jake Barnby <jakeb994@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants