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

feat: prisma go client added #385

Closed

Conversation

hosseinmirzapur
Copy link

@hosseinmirzapur hosseinmirzapur commented Jan 3, 2024

Closes issue #344

📑 Description

I've added the support for prisma go client to the artisan commands and the list of artisan commands are now updated with prisma commands as I added each command to the database directory service provider and tested each command, so no error happens. This prisma client is not supposed to change the way Goravel handles the DB right now. It's simply a database tool to handle migrations and database schema easier and it's fully compatible with the current built-in ORM tool. I haven't changed the facades.Orm() functionalities, and simply all I did is, added commands for prisma schema. Hope everyone has a better time developing great apps

  • Added prisma commands besides current artisan console commands
  • Prisma Studio command (according to this issue it's in development process)

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required (It doesn't require any changes to the docs, as it has all documentation included here)
  • All the tests have passed

ℹ Additional Information

Dependencies added:

Comparisons between new and old behavior:

  • more artisan commands available, prisma included

Copy link

codecov bot commented Jan 3, 2024

Codecov Report

Attention: 141 lines in your changes are missing coverage. Please review.

Comparison is base (88fc9bc) 69.26% compared to head (6ef75f2) 68.67%.
Report is 2 commits behind head on master.

Files Patch % Lines
database/service_provider.go 0.00% 20 Missing ⚠️
database/console/prisma/db_push_command.go 13.33% 13 Missing ⚠️
database/console/prisma/db_exec_command.go 33.33% 10 Missing ⚠️
database/console/prisma/db_pull_command.go 28.57% 10 Missing ⚠️
database/console/prisma/db_seed_command.go 46.66% 8 Missing ⚠️
database/console/prisma/debug_command.go 46.66% 8 Missing ⚠️
database/console/prisma/format_command.go 46.66% 8 Missing ⚠️
database/console/prisma/generate_command.go 46.66% 8 Missing ⚠️
database/console/prisma/init_command.go 52.94% 8 Missing ⚠️
database/console/prisma/migrate_deploy_command.go 52.94% 8 Missing ⚠️
... and 5 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #385      +/-   ##
==========================================
- Coverage   69.26%   68.67%   -0.60%     
==========================================
  Files         152      166      +14     
  Lines       10922    11166     +244     
==========================================
+ Hits         7565     7668     +103     
- Misses       2849     2990     +141     
  Partials      508      508              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hwbrzzl
Copy link
Contributor

hwbrzzl commented Jan 3, 2024

Thanks for your PR. Great work, but based on the goravel/goravel#344, I just think you want to use Prisma instead of Gorm in the Orm module and create a new development package for it.

We need to have a deep discussion if you want to add a new feature(like the commands in this PR) first, so unfortunately, this PR may not be merged into master at this time.

@hosseinmirzapur
Copy link
Author

Thanks for your PR. Great work, but based on the goravel/goravel#344, I just think you want to use Prisma instead of Gorm in the Orm module and create a new development package for it.

We need to have a deep discussion if you want to add a new feature(like the commands in this PR) first, so unfortunately, this PR may not be merged into master at this time.

Actually there is no replacement for the Gorm in the Orm module because it may change a lot of settings and a lot of files, which is not convenient. My goal was to make database operations easier, as if you check my added codes, you'll see that i'm not replacing Gorm with Prisma, but leveraging Prisma migration tools and commands to automate the migration creation, and make database module a lot more abstract than what it already is. All app models and Gorm functionalities may work just like before and also, current database artisan commands may work perfectly, and there's no change in the flow of Goravel app, and all Prisma will do is ease the way developers interact with database and also supports Mongodb as NoSQL and many relational databases which are yet to be added to Goravel, as their drivers don't exist(yet). Prisma is way more mature than Gorm by the way, but I actually haven't implemented the replacement for Gorm because i didn't want to change many codes and chose to get on with the Goravel flow and code principle. I made my intentions clear, so that my offered features may not sound too complicated or out of context

@hwbrzzl
Copy link
Contributor

hwbrzzl commented Jan 5, 2024

Yes, I understand, the PR is great, but we are not ready to integrate Prisma into the framework yet, this involves many aspects, so I suggest you can add these commands to an independent development package first. For detail: https://www.goravel.dev/digging-deeper/package-development.html

@hosseinmirzapur
Copy link
Author

Yes, I understand, the PR is great, but we are not ready to integrate Prisma into the framework yet, this involves many aspects, so I suggest you can add these commands to an independent development package first. For detail: https://www.goravel.dev/digging-deeper/package-development.html

Very well, I'll put them in a separate package as a library, and i'll open another PR. Thanks

@hosseinmirzapur
Copy link
Author

Hello again, I just finished developing the Go Prisma Client by following Goravel Extend package workflow.
You can find it here: Goravel Prisma
If you want to transfer ownership of the package, or use it by only referring to Goravel name on it, feel free to fork the mentioned repository, to create a new repository for Goravel.
Best Regards.

@hwbrzzl
Copy link
Contributor

hwbrzzl commented Jan 6, 2024

Thanks @hosseinmirzapur That's great!

@hwbrzzl hwbrzzl closed this Jan 6, 2024
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.

✨ [Feature] Support for Go-Prisma-Client
2 participants