-
Notifications
You must be signed in to change notification settings - Fork 167
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
chore: migrate to postgres and postgREST #263
Conversation
Deploying with
|
Latest commit: |
e5a575c
|
Status: | ✅ Deploy successful! |
Preview URL: | https://d8aaa9be.nft-storage.pages.dev |
5fd44b0
to
b4356c6
Compare
08c48bf
to
e371948
Compare
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.
🙏 comments and requests so far:
- I need to be able to review the PR and it's just too big currently.
- Please can we have a separate PR for cf-sync against this branch?
- Can we please remove the fauna stuff? We don't need it right?
- I don't understand why we have a duplicated
website
? Can it be avoided/minimised?
- Is a way we can just refactor the API code to use a database "client", and then pick the right one depending on the version number in the route URL?
- I don't believe we can enforce a foreign key constraint on the dagcargo
aggregate_entries
table to ourcontent
table because it refers to CIDs in web3.storage also. We may have to write stored procedures for retrieving the data we need when deals info is involved. - Can we remove references to superbase in our code (aside from importing the client from the
@superbase
namespace)? As far as I can tell we're just using postgREST supabase.ts
please can we not mix typscript and javascript!
i would ask you to just ignore all changes inside
done
Some stuff is a bit different specially in the auth keys pages, because now we can simplify a bunch. But i will reduce the duplication where possible.
We could but it gets a bit messy, i tried this already and changed to duplication.
we should, we just need to reference to join
done
im using .ts because the types i generate from the openapi endpoint are really hard to use with jsdocs this.client.from<definitions['account']>('account').upsert(account) |
We don't want differences! Just minimal changes to make this work and give me a fighting chance of reviewing the PR properly.
How come it got messy? The duplication is difficult to review because I can't tell what's new/old.
Please explain?
Understood but if we want to typescript things then we need a planned effort to do that. If we let this in it'll set precedence for a mixture and we'll not be able to spend time on it because what we have will be good enough and we'll end up doing other bits peicemeal. We'll then spend an extended period with a messy mixed code base and may never finish. I'm not saying it's undesirable, just we should do it later. Create a PR, open an issue and we'll get it in. |
Regarding the duplication:
the way i do this is, review in vscode with the github extension and just put the v0 and v1 files next to each other. Regarding fdw: i will remove typescript specific stuff and make everything js/jsdoc |
also i feel safer when deploy to production with the duplication, but i will try to merge everything at least in the website |
bah, nextjs doesnt support optional dynamic routes |
I've taken the schema from #263 with the following changes: * Primary keys are called `id` except where we're using domain data as the primary key (currently only `cid` in content) * Use shortened primary key definition to use `BIGSERIAL` for enhanced readability * Added `nftstorage` schema * Renamed `account` -> `user` * Make `issuer` NOT the primary key on `user`, added `id` column for primary and referenced it from other tables * Prefixed foreign keys with (complete) referenced table name where appropriate * Renamed `cid` in the `upload` table to `source_cid` so more obvious it is the given/original/provided/source CID * Added the `deleted_at` column to `upload` (and had to remove the `UNIQUE` constraint because of it) * Consistent enums capitalization to match web3.storage and niftysave * Added `upload_type` enum * Renamed `content.size` to `content.dag_size` for consistency with web3.storage
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've opened #395 so we can collaborate on the schema. It includes the changes in the comments.
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.
Not finished, but submitting feedback so far.
Note for me: I got down to packages/api/src/utils/db-client-types.ts
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.
Ok, I'm done reviewing for now.
I've ignored the cf-sync and cron changes. I believe they are coming in a different PR? Can we remove from here?
I've also not really looked at the website stuff. I'm still not sure I understand why the need to copy functionality? There should be no API changes, why can't we just build with a different API endpoint?
@hugomrdias remember to merge this with |
922b881
to
c17d230
Compare
e5a575c
to
05ac09f
Compare
This PR now holds the postgres migration code in the
/packages/api/db
.The
packages/db
folder still has the old fauna db code and will be deleted in the future.Refer to #331 for more info on the migration plan.