what is the reason for this error. (Prisma) - nestjs

I tried this command to apply db.
prisma migrate deploy
But it doesn't work.
Below error.
Error: P3009
migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: https://pris.ly/d/migrate-resolve

Did you take a look at the documentation provided by the error message?
https://pris.ly/d/migrate-resolve
The error is pretty self-descriptive: There was a failed migration in your database. In order to get rid of this error, you have a few options:
Mark the migration as rolled back, fix the migration, and try to redeploy it [https://www.prisma.io/docs/guides/database/production-troubleshooting#option-1-mark-the-migration-as-rolled-back-and-re-deploy]
prisma migrate resolve --rolled-back "NAME_OF_MIGRATION_TO_ROLLBACK"
Mark the migration as resolved (ignoring errors) and keep going https://www.prisma.io/docs/guides/database/production-troubleshooting#option-2-manually-complete-migration-and-resolve-as-applied
prisma migrate resolve --applied "NAME_OF_MIGRATION_TO_APPLY"
Completely reset the database, fix the migration, and reapply it

Related

The underlying table for model 'Order' does not exist. Error code: P1014 (Prisma)

I have such problem as below
$ prisma migrate dev --name "ok"
Error: P3006
Migration `2021080415559_order_linking` failed to apply clearnly to the shadow database.
Error code: P1014
Error:
The underlying table for model 'Order' does not exist.
How to fix it?
The solution:
It seems that this may be due to the migration file in the prisma folder.
I decided to delete the Migration Files and the whole folder with it. I restarted the application, it got a new file and it worked.
*delete the migrations folder*
$ prisma generate
$ prisma migrate dev --name "ok"
*it works*
It looks like your migrations were corrupted somehow. There was probably changes to your database that was not recorded in the migration history.
You could try one of these:
If you're okay with losing the data in the database, try resetting the database with prisma migrate reset. More info
Try running introspection to capture any changes to the database with prisma introspect before applying a new migration. More info

Error when debugging a data factory pipeline with global parameters

I added a few global parameters to a data factory pipeline. However, when starting a debug session, I get the following error. Any idea?
{"code":"BadRequest","message":null,"target":"pipeline//runid/xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxx","details":null,"error":null}
Removing the global parameters fixes the issue.
Any idea how to fix this issue?
Thanks
Have you tried going into monitor in data factory and check the issue under error section?
I faced similar issue once when i debugged the pipeline...but resolved the error by getting info from monitor error and making necessary changes to pipeline.

Azure: what could be the cause of the error "Unable to edit or replace deployment"?

When I recreate my VM I got the following error:
Problem occurred during request to Azure services. Cloud provider details: Unable to edit or replace deployment 'VM-Name': previous deployment from '8/20/2019 6:20:33 AM' is still active (expiration time is '8/27/2019 5:17:41 AM'). Please see https://aka.ms/arm-deploy for usage details.
Help me please to understand.
What could be the cause of the error ?
UPDATED:
This deployment has not been started previously.
Prior to this, errors were received during creation:
Azure is not available now. Please Try again later
There were several such errors one at a time and then I got that error related to:
Unable to edit or replace deployment
My assumptions about this.
Tell me, am I right or not ?
I launched the image, then after some time I recreated it.
Creation began, but at that moment the connection with Azure was lost.
Then, when the connection was restored, we tried to make a deployment that was not removed in the previous attempt (because there was no connection with Azure).
As a result, we got such an error.
Does this theory make sense?
exactly what it says, there is another deployment with the same name going on at this time, either change the name of the deployment you are trying to queue or wait for the other deployment to finish\fail
This can also occur if you use Bicep templates for your ARM deployement and multiple modules or resources in the template have the same name:
module fooModule '../modules/foo.bicep' = {
name: 'foo'
}
module barModule '../modules/bar.bicep' = {
name: 'foo'
}
I got the same error initially pipeline was working but when retriggered pipeline took more time so i canceled the deployment and made a fresh rerun it encounters. i think i need wait until that deployment filed.

PouchDB Push Replication does not push new documents

Am using PouchDB version 5.2.1 with nodejs version 0.10.26. Recently I encountered a problem, where out of my two different instances of PouchDB in one instance the push replication was working fine but in other instance the push replication was not happening.
I further dug deeper into the library I found that in the file pouchdb/lib/index.js a function named startNextBatch() is called. Inside the function we are checking for the condition
if (returnValue.cancelled || currentBatch) {
return;
}
In success scenario the currentBatch was undefined and hence the code didnt return back and the push happened, but in failure scenario the currentBatch was defined and return was called.The documents present in currentBatch variable are the previous documents which had got pushed to server but couldn't sync back due to some other issue and also the checkpoints for them couldnt be updated, hence the currentBatch variable was not cleared.
My question is :
1)What impact will it have if i comment the return from the code.
2)Why is push replication stopped because the variable currentBatch is defined.
After some further debugging I found out that the replication has totally stopped with status code 503 unknown database error. This has happened because there is some problem with my sync gateway and some documents takes time to sync back ,hence writing checkpoints throws 503 unknown error (am not exactly sure why checkpoints are getting messed up because some documents got synced and others got synced after some time). The PouchDB library totally aborts the replication and after that no push happens.
1) If I comment the return, the current document will get pushed but since replication is aborted there will be no checkpoints saved.
2) Push replication didnt stop because currentBatch is defined. currentBatch is defined because replication is not happenning.

Issue with sequelize migrations to heroku

I have been sitting at this computer for 7 hours straight trying to deploy my app. There is a node/express backend serving up restricted API json data at different endpoints. In order to get access to this json data you have to have a token.
It all works fine and dandy on my local server during development. However, when I go to send the migrations to heroku (using 'heroku run bash', then 'sequelize db:migrate), I get some random error saying "SyntaxError: Unexpected String"..as shown below.
As you can see, when I run sequelize:db:migrate:undo, it says that no executed migrations found.
```
Sequelize [Node: 5.11.1, CLI: 2.4.0, ORM: 3.24.3, pg: ^6.1.0]
Loaded configuration file "config/config.json".
Using environment "production".
== 20160917224717-create-user: migrating =======
[SyntaxError: Unexpected string]
~ $ sequelize db:migrate:undo
Sequelize [Node: 5.11.1, CLI: 2.4.0, ORM: 3.24.3, pg: ^6.1.0]
Loaded configuration file "config/config.json".
Using environment "production".
No executed migrations found.
~ $
```
However, when I look in my heroku database, I DO see that there is now 1 table. However, that table does not work, and I am still getting an error on form submit to create a user. The error I get on form submit is:
message: "relation "users" does not exist"
name: "SequelizeDatabaseError"
What gives? This alleged syntax unexpected string error does not throw when I am running locally. It runs smooth as butter with the migrations. What could this be?
Thanks.
Either you have not updated your code on the server to match your local environment or your database does not match. "Users relation" implies the users table is related to another table. Make sure the code is really updated (if sequelize code mentions this relation) AND all other tables are reproduced on the server.
Once I got a problem with accessing postgres db on Heroku (provided as an add-on):
I installed SQL Shell (psql) on my laptop
I logged-in to the db (used all necessary credentials)
run: \dt to check db schema => result: 'no relations', so the migration wasn't done yet
run migrate:db
run: \dt => schema is here - OK!
now: run heroku console
login to your account
run: heroku restart -a=<my_app>
If the lack of db:migration was a problem only, it should be fine now.
You can also try to reset your db first (if your data isn't precious!) running: heroku pg:reset -a=<my_app>

Resources