-
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
Add Postgres Adapter #107
Add Postgres Adapter #107
Conversation
Hey @vermakhushboo , |
Hey @KevinJ-hub, have you made considerable progress on the same? If yes, please take this forward, otherwise, I'd request you to pick something else. |
Yes, I have started working on it from January. I had a discussion with the appwrite team on their discord server as well regarding me working on this and then on their approval, I started to work on it. |
@KevinJ-hub Please create a PR with your changes. The postgres adapter has a high priority at the moment and we want to ensure you have enough time to pick it up. We're expecting to ship it in the coming week. Let us know if you would be able to commit to it 🙂 |
@christyjacob4 Ohhh, I won't be able to commit on finishing it in a week since I am currently a bit caught up with college work. If thats the case then its fine @vermakhushboo you can please continue with postgres adapter I might pick something else and work on it. 👍 |
@KevinJ-hub Thank you so much for understanding! Really appreciate the honesty. If you need some guidance on issues you can pick up, please let me know. I'd be happy to assist. |
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.
Hey @vermakhushboo ,
The double quotes wrapped around role in read and write permission seem to be redundent over here since they do not get stored in the postgres DB. So I would like to request you to please check it once and remove them.
src/Database/Adapter/Postgres.php
Outdated
VALUES ({$columns} :_uid, :_read, :_write)"); | ||
|
||
$read = array_map(fn($role) => '"'.$role.'"', $document->getRead()); |
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.
The double quotes wrapped around role seem to be redundent
src/Database/Adapter/Postgres.php
Outdated
|
||
$read = array_map(fn($role) => '"'.$role.'"', $document->getRead()); | ||
$write = array_map(fn($role) => '"'.$role.'"', $document->getWrite()); |
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.
Same as above
src/Database/Adapter/Postgres.php
Outdated
SET {$columns} _uid = :_uid, _read = :_read, _write = :_write WHERE _uid = :_uid"); | ||
|
||
$read = array_map(fn($role) => '"'.$role.'"', $document->getRead()); |
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.
Same as above
src/Database/Adapter/Postgres.php
Outdated
|
||
$read = array_map(fn($role) => '"'.$role.'"', $document->getRead()); | ||
$write = $read = array_map(fn($role) => '"'.$role.'"', $document->getWrite()); |
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.
Same as above
…at-postgress-adapter-eldad
Merge latest postgres changes into original postgres PR
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.
Looks really good! One small type change and some readability updates and I think we'll be good to go 😁
Work in progress
Edge cases in Appwrite but not in Utopia
Had to change the exception type to ‘Throwable’ instead of ‘PDOException’ for Appwrite as the exception wasn’t getting captured in createDocument and updateDocument methods
TODO:
There are not enough tests in Utopia to verify that double-quotes were needed around {$attribute} in the find() method to handle reserved words
TODO:
Had to remove all alphanumeric values in getSQLCondition() method. Need to add better edge cases for full-text search in Utopia, it is missing many cases
TODO:
Improvements needed in Appwrite for future adapters
TODO: