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

Migration Error to 4.6.1 #129

Open
paallaire opened this issue Jan 8, 2025 · 0 comments
Open

Migration Error to 4.6.1 #129

paallaire opened this issue Jan 8, 2025 · 0 comments

Comments

@paallaire
Copy link

When upgrading to 4.6.1 from 4.5.2, I get an error about a null value in column "id" of relation "googlemaps_addresses" violates not-null constraint.

Version

"craftcms/cms": "4.13.7",
"doublesecretagency/craft-googlemaps": "4.5.2"

ddev (environment local)

php_version: "8.2"
database:
    type: postgres
    version: "14"

When I try to update locally, I get the following message:

Error message:

Integrity constraint violation: SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "id" of relation "googlemaps_addresses" violates not-null constraint
DETAIL: Failing row contains (null, 4348, 80, null, null, null, Lorem street , null, Lorem city, QC, X3X XGX, null, Lorem country, null, 42.00, -68.55545454, 11, 2019-07-03 17:07:23, 2025-01-08 19:09:45, cd6aa46e-e63c-4e1f-b205-ed0c7e5a665c, null, null, 2).
The SQL being executed was: INSERT INTO "googlemaps_addresses" ("id", "elementId", "fieldId", "formatted", "raw", "name", "street1", "street2", "city", "state", "zip", "county", "country", "placeId", "lat", "lng", "zoom", "dateCreated", "dateUpdated", "uid", "neighborhood", "countryCode", "siteId") VALUES (NULL, 4348, 80, NULL, NULL, NULL, 'Lorem street ', NULL, 'Lorem city', 'QC', 'X3X XGX', NULL, 'Lorem country', NULL, '42.00', '-68.55545454', 11, '2019-07-03 17:07:23', '2025-01-08 19:09:45', 'cd6aa46e-e63c-4e1f-b205-ed0c7e5a665c', NULL, NULL, 2) ON CONFLICT DO NOTHING

Migration: doublesecretagency\googlemaps\migrations\m240530_122024_multisite_support

Output:

> add column siteId integer to table {{%googlemaps_addresses}} ... done (time: 0.001s)
> upsert into {{%googlemaps_addresses}} ...Exception: SQLSTATE[23502]: Not null violation: 7 ERROR: null value in column "id" of relation "googlemaps_addresses" violates not-null constraint
DETAIL: Failing row contains (null, 4348, 80, null, null, null, Lorem street , null, Lorem city, QC, X3X XGX, null, Lorem country, null, 42.00, -68.55545454, 11, 2019-07-03 17:07:23, 2025-01-08 19:09:45, cd6aa46e-e63c-4e1f-b205-ed0c7e5a665c, null, null, 2).
The SQL being executed was: INSERT INTO "googlemaps_addresses" ("id", "elementId", "fieldId", "formatted", "raw", "name", "street1", "street2", "city", "state", "zip", "county", "country", "placeId", "lat", "lng", "zoom", "dateCreated", "dateUpdated", "uid", "neighborhood", "countryCode", "siteId") VALUES (NULL, 4348, 80, NULL, NULL, NULL, 'Lorem street ', NULL, 'Lorem city', 'QC', 'X3X XGX', NULL, 'Lorem country', NULL, '42.00', '-68.55545454', 11, '2019-07-03 17:07:23', '2025-01-08 19:09:45', 'cd6aa46e-e63c-4e1f-b205-ed0c7e5a665c', NULL, NULL, 2) ON CONFLICT DO NOTHING (/var/www/html/vendor/yiisoft/yii2/db/Schema.php:676)
#0 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1325): yii\db\Schema->convertException(Object(PDOException), 'INSERT INTO "go...')
#1 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1120): yii\db\Command->internalExecute('INSERT INTO "go...')
#2 /var/www/html/vendor/craftcms/cms/src/db/Migration.php(231): yii\db\Command->execute()
#3 /var/www/html/vendor/doublesecretagency/craft-googlemaps/src/migrations/m240530_122024_multisite_support.php(173): craft\db\Migration->upsert('{{%googlemaps_a...', Array, false)
#4 /var/www/html/vendor/doublesecretagency/craft-googlemaps/src/migrations/m240530_122024_multisite_support.php(43): doublesecretagency\googlemaps\migrations\m240530_122024_multisite_support->_populateData()
#5 /var/www/html/vendor/craftcms/cms/src/db/Migration.php(50): doublesecretagency\googlemaps\migrations\m240530_122024_multisite_support->safeUp()
#6 /var/www/html/vendor/craftcms/cms/src/db/MigrationManager.php(233): craft\db\Migration->up(true)
#7 /var/www/html/vendor/craftcms/cms/src/db/MigrationManager.php(149): craft\db\MigrationManager->migrateUp(Object(doublesecretagency\googlemaps\migrations\m240530_122024_multisite_support))
#8 /var/www/html/vendor/craftcms/cms/src/services/Updates.php(252): craft\db\MigrationManager->up()
#9 /var/www/html/vendor/craftcms/cms/src/controllers/BaseUpdaterController.php(493): craft\services\Updates->runMigrations(Array)
#10 /var/www/html/vendor/craftcms/cms/src/controllers/UpdaterController.php(209): craft\controllers\BaseUpdaterController->runMigrations(Array, 'restore-db')
#11 [internal function]: craft\controllers\UpdaterController->actionMigrate()
#12 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#13 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#14 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('migrate', Array)
#15 /var/www/html/vendor/craftcms/cms/src/web/Application.php(341): yii\base\Module->runAction('updater/migrate', Array)
#16 /var/www/html/vendor/craftcms/cms/src/web/Application.php(733): craft\web\Application->runAction('updater/migrate')
#17 /var/www/html/vendor/craftcms/cms/src/web/Application.php(266): craft\web\Application->_processUpdateLogic(Object(craft\web\Request))
#18 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#19 /var/www/html/web/index.php(12): yii\base\Application->run()
#20 {main}
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

No branches or pull requests

1 participant