Prisma push comand does not update Schema in cloud - prisma

I am using Prisma Cloud to quickly prototyping an app. I connected it to Postgres via Heroku.
I have my schema defined in prisma/schema.prisma.
When I modifiy the schema, the docs say to run the command:
npx prisma db push
When I do so, I received this message in terminal:
Your database is now in sync with your schema.
If I go to Prisma Studio, the schema has not change.
However, if I push my code to Github, the schema changes.
I was expecting that npx prisma db push would automatically change the schema in the cloud without the need to push on Github.
Am I wrong?

npx prisma db push just updates your database schema.
To update your schema.prisma file in Prisma Cloud you are supposed to push the code to the GitHub branch with which you have associated your environment. Each environment in Prisma cloud project has one to one relation with a GitHub branch.
Once you push changes to GitHub, Prisma cloud receives a webhook from GitHub and it then updates the schema. You can see the latest schema of your project in schema tab, attached image for reference.
It also shows the last time when schema was updated.

Related

How do I permanently delete failed prisma migrations in productions to keep it in sync with my local prisma migrations folder?

I'm experiencing an error while deploying my remix app to fly via github actions.
I recently altered one of my schemas, which led to the failed migration. I have deleted the migrations in the prisma/migrations folder and the local _prisma_migrations table and did a fresh prisma migrate dev. When I push to github I get an error that one of the migrations that I deleted could not be applied. How do I delete it completely in the production environment?

.db file from Heroku app does not sync with github repository [duplicate]

This question already has answers here:
Does heroku automatically update the repository?
(1 answer)
Heroku via Github, where is my JSON files updated?
(2 answers)
Closed last month.
I have this app on Heroku that deploys code from a GitHub repository. In this GitHub repository, there is this database file "something.db", which has all the necessary fields but empty of any records. When I build the app on Heroku and deploy it, it pulls the code from the GitHub repository, including the "something.db" database file. When people access the website, when they register a user account for example, the app inserts a new record to the database "something.db". However, I have some a concern about this:
How would I be able to sync this "something.db" database file from the Heroku app back to the GitHub repository? I.e. How can the GitHub repository be able to see the data changes in the "something.db" database file once I create a new user on the website.
I am asking this question in the context that every time I need to push code onto that GitHub repository, I would need to redeploy the app from heroku, which will then also deploy the empty "something.db" database file, which I do not want, since I want to retain the data that was previously added while the website was live.
I know this method of storing data in a .db file is not professional, but I would like to keep things as simple as possible since this website is small scale and does not hold that much data.
The app that I am using is a python Flask app, and the database is using flask alchemy (sqlite).
I tried looking online for some answers on how to push the changes from Heroku back to the GitHub pipeline but could not find anything about it. All I saw was how to deploy an app FROM GitHub to Heroku, but not push code FROM Heroku back to the GitHub repository.

Too many Prisma migration files

I'm currently working on a project that we are using Prisma 2 and postgreSQL as database support. From my understanding, whenever I made changes to the schema.prisma file and I want to migrate the changes to the database, I run prisma migrate dev locally. Then I will push the auto created migration files under migration folder to Github, and then our repo will run prisma migrate deploy to the staging or production server.
So, my concern is, each time I run prisma migrate dev, a new migration file will be created in migrations folder. So, there will be a lot of migration files under the migration folder with the development of the project. Is that what supposed to happen? Or is there a better way?
Thank you for your help. I'm pretty new to Prisma 2 and still trying to find the correct way to work with it. BTW I think Prisma 1 was easier to use :)
I’d recommend using prisma db push while developing locally and generating the migration with prisma migrate dev only when you think the schema changes are good to go. More at https://www.prisma.io/docs/guides/database/prototyping-schema-db-push
So, there will be a lot of migration files under the migration folder
with the development of the project. Is that what supposed to happen?
Yes, this is exactly what's supposed to happen. The migration file contains the history of all changess to your Prisma schema (and underlying database tables/configuration), so they all need to be retained.
I'm not sure if you could go around this somehow, but it's certainly not the recommended way to be using migrate.
You can find a list of best practices regarding migration in the Prisma migrate article in the docs.
It's been a very long time since the question is asked, but i want to warn about something:
As you may notice a table named _prisma_migrations is created by prisma automaticly and every time you add a new migration you are able to see the new migration's data over there. So any manual change made in migrations folder can cause problems since it breaks the relations between folder names and _prisma_migrations table.
Also docs for "squashing migrations": https://www.prisma.io/docs/guides/database/developing-with-prisma-migrate/squashing-migrations

Prisma migrate dev: Run command while connected to DB?

Context: Our staging and production postgres databases are in a managed SQL service.
Is it recommended to create a local postgres database to run the command the npx prisma migrate dev?
Once the migration files are generated (as a result of running this command), we should then be able to run the npx prisma migrate deploy command on staging and prod environments.
You are correct. You should only be using npx prisma migrate dev in a local/development database. Once you are done with development and migrations have been created, you apply them to your staging/production database using npx prisma migrate deploy.
I would recommend checking out these two articles from the Prisma docs:
Prisma Migrate: Concept Guide
Deploying database changes with Prisma Migrate

Generate Swift Code From Changed GraphQL File Without Pushing Changes To The Cloud

I use AWS Amplify & GraphQL inside my iOS project. I would like to update my API.swift file based on my changed GraphQL file. The following Amplify CLI command accomplishes this, but pushes changes to the cloud...
amplify push
How can I generate an updated GraphQL file without pushing changes to the cloud?
Are you making changes to your schema or your queries/mutations? If you're making changes to your queries and mutations inside your graphql folder with the queries.graphql, mutations.graphql, and subscriptions.graphql, you can run amplify codegen types