Just upgraded my Appwrite instance from 1.6.1 → 1.7.4 and ran into some issues during the migration process. What I did:
- Upgraded Appwrite to 1.7.4
- Imported my backup using:
sudo docker-compose exec -T mariadb sh -c 'exec mysql -u"$MYSQL_USER" -p"$MYSQL_PASSWORD"' < ./backups/appwrite-dump-20250820_131433.sql - Ran migration with docker compose exec appwrite migrate
The Error I'm Getting:
sudo docker compose exec appwrite migrate Starting Data Migration to version 1.7.4 [Error] Timestamp: 2025-08-21T12:24:44+00:00 [Error] Type: PDOException [Error] Message: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'appwrite._console_devKeys' doesn't exist [Error] File: @swoole/library/core/Database/PDOStatementProxy.php
Questions:
Is this a known compatibility issue between these versions? Should I be running additional setup commands after restoring the database backup? Any suggestions on how to fix this missing table issue?
Any help would be much appreciated! 🙏
You missed 1.6.2
Imported backup after upgrading to 1.7.4? Why?
You should restore to your 1.6.1 backup, upgrade to 1.6.2, and then 1.7.4
i try it but i have the same error
I created it manually and it seems to work
CREATE TABLE IF NOT EXISTS
_console_devKeys(_idvarchar(255) NOT NULL,_createdAtdatetime(3) DEFAULT NULL,_updatedAtdatetime(3) DEFAULT NULL,_permissionsmediumtext,projectInternalIdvarchar(255) DEFAULT NULL,projectIdvarchar(255) DEFAULT NULL,namevarchar(255) DEFAULT NULL,secretvarchar(512) DEFAULT NULL,expiredatetime(3) DEFAULT NULL,accessedAtdatetime(3) DEFAULT NULL,sdkslongtext, PRIMARY KEY (_id), KEY_createdAt(_createdAt), KEY_updatedAt(_updatedAt), KEYprojectInternalId(projectInternalId), KEYaccessedAt(accessedAt) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;CREATE TABLE IF NOT EXISTS
_console_devKeys_perms(_idvarchar(255) NOT NULL,_typevarchar(12) NOT NULL,_permissionvarchar(255) NOT NULL, PRIMARY KEY (_id,_type,_permission), KEY_permission(_permission) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
I have this now, but idk if it's a serious error or not
Failed to update document "67f7fc48398859fd9918" in collection "rules":Invalid document structure: Unknown attribute: "region"
But i still have a error 500 :/
any solutions?
I have the same problem and I did upgrade from 1.6.1 -> 1.6.2 then migrate afterwards upgraded to 1.7.4 including migration - but still the same problem
Any Ideas?
I now tried to upgrade from 1.6.2 -> 1.7.5 - here I got the same problem again.
After that I tried to upgrade from 1.6.2 -> 1.7.0 here I got this error:
''' Failed to update document "681f9a0994fc82193964" in collection "rules":Invalid document structure: Missing required attribute "region" Failed to update document "681f9b483a735d7bab56" in collection "rules":Invalid document structure: Missing required attribute "region" Failed to update document "681f9bd896b4b809d48b" in collection "rules":Invalid document structure: Missing required attribute "region" Failed to update document "681f9d2a429e8c09c1d4" in collection "rules":Invalid document structure: Missing required attribute "region" Failed to update document "681f9f3be00e0ab421a6" in collection "rules":Invalid document structure: Missing required attribute "region" Failed to update document "682316392d2d77092897" in collection "rules":Invalid document structure: Missing required attribute "region" Failed to migrate project "console" with error: Collection not found [Error] Timestamp: 2025-12-23T20:37:49+00:00 [Error] Type: Utopia\Database\Exception\NotFound [Error] Message: Collection not found [Error] File: /usr/src/code/vendor/utopia-php/database/src/Database/Database.php [Error] Line: 3188 [Error] Trace: #0 /usr/src/code/src/Appwrite/Migration/Version/V22.php(352): Utopia\Database\Database->getDocument(Object(Utopia\Database\Document), '675065cb0002607...') #1 /usr/src/code/src/Appwrite/Migration/Migration.php(177): Appwrite\Migration\Version\V22->migrateDocument(Object(Utopia\Database\Document)) #2 /usr/src/code/vendor/utopia-php/database/src/Database/Database.php(6123):
Appwrite\Migration\Migration->Appwrite\Migrationclosure}(Object(Utopia\Database\Document)) #3 /usr/src/code/src/Appwrite/Migration/Migration.php(171): Utopia\Database\Database->foreach('rules', Object(Closure)) #4 /usr/src/code/src/Appwrite/Migration/Version/V22.php(38): Appwrite\Migration\Migration->forEachDocument(Object(Closure)) #5 /usr/src/code/src/Appwrite/Platform/Tasks/Migrate.php(93): Appwrite\Migration\Version\V22->execute() #6 /usr/src/code/vendor/utopia-php/cli/src/CLI/CLI.php(321): Appwrite\Platform\Tasks\Migrate->action('1.7.0', Object(Utopia\Database\Database), Object(Closure), Object(Utopia\Registry\Registry)) #7 [internal function]: Utopia\CLI\CLI->run() #8 {main}
<@462046107556511744> merry christmas - I hope you can help me, this is a production server and it would be fatal if this Update will not work.
THanks - have some nice days.
best regards
ok - I solved it!
I also added the dev keys manually in the mariadb - with this command:
CREATE TABLE IF NOT EXISTS `_console_devKeys` (
`_id` varchar(255) NOT NULL,
`_uid` varchar(255) DEFAULT NULL,
`_createdAt` datetime(3) DEFAULT NULL,
`_updatedAt` datetime(3) DEFAULT NULL,
`_permissions` mediumtext,
`projectInternalId` varchar(255) DEFAULT NULL,
`projectId` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`secret` varchar(512) DEFAULT NULL,
`expire` datetime(3) DEFAULT NULL,
`accessedAt` datetime(3) DEFAULT NULL,
`sdks` longtext,
PRIMARY KEY (`_id`),
KEY `_createdAt` (`_createdAt`),
KEY `_updatedAt` (`_updatedAt`),
KEY `projectInternalId` (`projectInternalId`),
KEY `accessedAt` (`accessedAt`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `_console_devKeys_perms` (
`_id` varchar(255) NOT NULL,
`_type` varchar(12) NOT NULL,
`_permission` varchar(255) NOT NULL,
PRIMARY KEY (`_id`, `_type`, `_permission`),
KEY `_permission` (`_permission`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
ALTER TABLE `_console_rules` ADD COLUMN IF NOT EXISTS `region` VARCHAR(255) DEFAULT 'default';
ALTER TABLE `_console_buckets` ADD COLUMN IF NOT EXISTS `region` VARCHAR(255) DEFAULT 'default';
ALTER TABLE `_console_databases` ADD COLUMN IF NOT EXISTS `region` VARCHAR(255) DEFAULT 'default';
exit;
after that I did
docker compose exec redis redis-cli flushall
then I was wondering if the migration would work - but it didn't... I git this error:
appwrite | Fatal error: Uncaught PDOException: SQLSTATE[42S01]: Base table or view already exists: 1050 Table '_console_devKeys' already exists in @swoole/library/core/Database/PDOStatementProxy.php:49
appwrite | Stack trace:
appwrite | #0 @swoole/library/core/Database/PDOStatementProxy.php(49): PDOStatement->execute()
appwrite | #1 /usr/src/code/vendor/utopia-php/database/src/Database/Adapter/MariaDB.php(221): Swoole\Database\PDOStatementProxy->__call('execute', Array)
So I was thinking - appwrite wants to create the dev Keys in the migration, so i added this:
INSERT INTO `_console_metadata` (`_uid`, `name`, `attributes`, `indexes`, `status`)
VALUES ('devKeys', 'devKeys', '[]', '[]', 'available')
ON DUPLICATE KEY UPDATE status='available';
INSERT INTO `_console_metadata` (`_uid`, `name`, `attributes`, `indexes`, `status`)
VALUES ('devKeys_perms', 'devKeys_perms', '[]', '[]', 'available')
ON DUPLICATE KEY UPDATE status='available';
exit;
after this I cleared the docker cache and restarted the container
docker compose exec redis redis-cli flushall && docker compose restart appwrite
now the migration was also not successful - so I renamed the tables into:
RENAME TABLE `_console_devKeys` TO `_console_devKeys_temp`;
RENAME TABLE `_console_devKeys_perms` TO `_console_devKeys_perms_temp`;
after that i restarted the container with
docker compose restart appwrite
and started the migration - NOW IT WAS SUCCESSFUL.
Hope this helps someone in the future
Recommended threads
- Export, Import or Migration giving this ...
As you can see in yhe screenshot i am not able to export any data or export the data from tables. Also it is affecting the migration from appwrite to appwrite h...
- local (self-hosted) sites issues
setup: - `composer run installer:dev` issues - Getting error when visiting the site ```Synchronous function execution timed out. Use asynchronous execution in...
- I'm getting an error on the console "j?....
On my self hosted instance version 1.8.1 the console is giving me this error when trying to view the rows for a table I recently created. My application is read...