Created
October 16, 2024 15:39
-
-
Save arcanoix/6a012afded621f1780d54c124ce73621 to your computer and use it in GitHub Desktop.
Mysql Cluster DigitalOcean - error de primary key migration laravel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Digital Ocean has an API that you can use to configure the settings of your DB, which I would highly recommend over other solutions. You can do the following: | |
Create an API token if you don't have one already: https://cloud.digitalocean.com/account/api/tokens | |
Find the ID of your database cluster by querying the List all database clusters endpoint: | |
curl -X GET \ | |
-H "Content-Type: application/json" \ | |
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ | |
"https://api.digitalocean.com/v2/databases" | |
Once you've found the ID of your database cluster, you can make a patch request to the update database config endpoint: | |
curl -X PATCH \ | |
-H "Content-Type: application/json" \ | |
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ | |
-d '{"config": {"sql_require_primary_key": true}}' \ | |
"https://api.digitalocean.com/v2/databases/$DATABASE_CLUSTER_ID/config" | |
Now your database cluster will be configured, permanently, without any code changes. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment