[GH-ISSUE #1558] Can't create table bitwarden_rs.sends (errno: 150 "foreign key constraint is incorrectly formed") [v 1.20] #1001

Closed
opened 2026-03-03 02:05:25 +03:00 by kerem · 6 comments
Owner

Originally created by @FuzzyMistborn on GitHub (Mar 29, 2021).
Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/1558

Subject of the issue

When updating to the latest v 1.20 docker image, I get the below error and the container will not load.

Deployment environment

Your environment (Generated via diagnostics page)

  • Bitwarden_rs version: v1.19.0
  • Web-vault version: v2.18.1
  • Running within Docker: true
  • Internet access: true
  • Uses a proxy: false
  • DNS Check: true
  • Time Check: true
  • Domain Configuration Check: true
  • HTTPS Check: true
  • Database type: MySQL
  • Database version: [PLEASE PROVIDE DATABASE VERSION]
  • Clients used:
  • Reverse proxy and version:
  • Other relevant information:

Config (Generated via diagnostics page)

{
  "_duo_akey": null,
  "_enable_duo": false,
  "_enable_email_2fa": true,
  "_enable_smtp": true,
  "_enable_yubico": true,
  "_ip_header_enabled": true,
  "admin_token": "***",
  "allowed_iframe_ancestors": "",
  "attachments_folder": "data/attachments",
  "authenticator_disable_time_drift": false,
  "data_folder": "data",
  "database_max_conns": 10,
  "database_url": "*****://*********:**********.*********.*********@***.***.**.**:****/************",
  "db_connection_retries": 15,
  "disable_2fa_remember": false,
  "disable_admin_token": false,
  "disable_icon_download": false,
  "domain": "*****://*********.****.****",
  "domain_origin": "*****://*********.****.****",
  "domain_path": "",
  "domain_set": true,
  "duo_host": null,
  "duo_ikey": null,
  "duo_skey": null,
  "email_attempts_limit": 3,
  "email_expiration_time": 600,
  "email_token_size": 6,
  "enable_db_wal": false,
  "extended_logging": true,
  "helo_name": null,
  "hibp_api_key": null,
  "icon_blacklist_non_global_ips": true,
  "icon_blacklist_regex": null,
  "icon_cache_folder": "data/icon_cache",
  "icon_cache_negttl": 259200,
  "icon_cache_ttl": 2592000,
  "icon_download_timeout": 10,
  "invitation_org_name": "XXXXXX",
  "invitations_allowed": true,
  "ip_header": "X-Real-IP",
  "log_file": "/data/bitwarden.log",
  "log_level": "Info",
  "log_timestamp_format": "%Y-%m-%d %H:%M:%S.%3f",
  "org_attachment_limit": null,
  "org_creation_users": "",
  "password_iterations": 100000,
  "reload_templates": false,
  "require_device_email": false,
  "rsa_key_filename": "data/rsa_key",
  "show_password_hint": true,
  "signups_allowed": false,
  "signups_domains_whitelist": "",
  "signups_verify": false,
  "signups_verify_resend_limit": 6,
  "signups_verify_resend_time": 3600,
  "smtp_accept_invalid_certs": false,
  "smtp_accept_invalid_hostnames": false,
  "smtp_auth_mechanism": null,
  "smtp_debug": false,
  "smtp_explicit_tls": false,
  "smtp_from": "*********@****.****",
  "smtp_from_name": "Bitwarden",
  "smtp_host": "**-**.*******.***",
  "smtp_password": "***",
  "smtp_port": 587,
  "smtp_ssl": true,
  "smtp_timeout": 15,
  "smtp_username": "********************************",
  "templates_folder": "data/templates",
  "use_syslog": false,
  "user_attachment_limit": null,
  "web_vault_enabled": true,
  "web_vault_folder": "web-vault/",
  "websocket_address": "0.0.0.0",
  "websocket_enabled": true,
  "websocket_port": 3012,
  "yubico_client_id": "47172",
  "yubico_secret_key": "***",
  "yubico_server": null
}

Docker, here's the below information based on my 1.19 install

  • bitwarden_rs version: 1.20
  • Install method: Docker image

  • Clients used: N/A

  • Reverse proxy and version: N/A

  • MySQL/MariaDB or PostgreSQL version: 10.5.9

  • Other relevant details:

Steps to reproduce

Just updated the container from current install

Expected behaviour

Container will load

Actual behaviour

I get the below error in the log and it just loops the error/fails to complete the load

Troubleshooting data

Log:

/--------------------------------------------------------------------\

|                       Starting Bitwarden_RS                        |

|                           Version 1.20.0                           |

|--------------------------------------------------------------------|

| This is an *unofficial* Bitwarden implementation, DO NOT use the   |

| official channels to report bugs/features, regardless of client.   |

| Send usage/configuration questions or feature requests to:         |

|   https://bitwardenrs.discourse.group/                             |

| Report suspected bugs/issues in the software itself at:            |

|   https://github.com/dani-garcia/bitwarden_rs/issues/new           |

\--------------------------------------------------------------------/


FO] No .env file found.


[WARNING] The following environment variables are being overriden by the config file,

[WARNING] please use the admin panel to make changes to them:

[WARNING] SIGNUPS_ALLOWED, ADMIN_TOKEN, SMTP_HOST, SMTP_SSL, SMTP_PORT, SMTP_FROM, SMTP_USERNAME, SMTP_PASSWORD


Running migration 20210311190243

Executing migration script 20210311190243/up.sql

[2021-03-29 12:34:53.936][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError.

[CAUSE] QueryError(

    DatabaseError(

        __Unknown,

        "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")",

    ),

)

Running migration 20210311190243

Executing migration script 20210311190243/up.sql

[2021-03-29 12:34:54.947][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError.

[CAUSE] QueryError(

    DatabaseError(

        __Unknown,

        "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")",

    ),

)

Running migration 20210311190243

Executing migration script 20210311190243/up.sql

[2021-03-29 12:34:55.958][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError.

[CAUSE] QueryError(

    DatabaseError(

        __Unknown,

        "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")",

    ),

)

Running migration 20210311190243

Executing migration script 20210311190243/up.sql

[2021-03-29 12:34:56.968][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError.

[CAUSE] QueryError(

    DatabaseError(

        __Unknown,

        "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")",

    ),

)

Running migration 20210311190243

Executing migration script 20210311190243/up.sql

[2021-03-29 12:34:57.978][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError.

[CAUSE] QueryError(

    DatabaseError(

        __Unknown,

        "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")",

    ),

)

Running migration 20210311190243

Executing migration script 20210311190243/up.sql

[2021-03-29 12:34:58.988][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError.

[CAUSE] QueryError(

    DatabaseError(

        __Unknown,

        "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")",

    ),

)

Running migration 20210311190243

Executing migration script 20210311190243/up.sql

[2021-03-29 12:34:59.999][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError.

[CAUSE] QueryError(

    DatabaseError(

        __Unknown,

        "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")",

    ),

)

Running migration 20210311190243

Executing migration script 20210311190243/up.sql

[2021-03-29 12:35:01.009][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError.

[CAUSE] QueryError(

    DatabaseError(

        __Unknown,

        "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")",

    ),

)

Running migration 20210311190243

Executing migration script 20210311190243/up.sql

[2021-03-29 12:35:02.020][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError.

[CAUSE] QueryError(

    DatabaseError(

        __Unknown,

        "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")",

    ),

)

Running migration 20210311190243

Executing migration script 20210311190243/up.sql

[2021-03-29 12:35:03.030][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError.

[CAUSE] QueryError(

    DatabaseError(

        __Unknown,

        "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")",

    ),

)

Running migration 20210311190243

Executing migration script 20210311190243/up.sql

[2021-03-29 12:35:04.039][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError.

[CAUSE] QueryError(

    DatabaseError(

        __Unknown,

        "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")",

    ),

)

Running migration 20210311190243

Executing migration script 20210311190243/up.sql

[2021-03-29 12:35:05.049][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError.

[CAUSE] QueryError(

    DatabaseError(

        __Unknown,

        "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")",

    ),

)
Originally created by @FuzzyMistborn on GitHub (Mar 29, 2021). Original GitHub issue: https://github.com/dani-garcia/vaultwarden/issues/1558 <!-- # ### NOTE: Please update to the latest version of bitwarden_rs before reporting an issue! This saves you and us a lot of time and troubleshooting. See: * https://github.com/dani-garcia/bitwarden_rs/issues/1180 * https://github.com/dani-garcia/bitwarden_rs/wiki/Updating-the-bitwarden-image # ### --> <!-- Please fill out the following template to make solving your problem easier and faster for us. This is only a guideline. If you think that parts are unnecessary for your issue, feel free to remove them. Remember to hide/redact personal or confidential information, such as passwords, IP addresses, and DNS names as appropriate. --> ### Subject of the issue <!-- Describe your issue here. --> When updating to the latest v 1.20 docker image, I get the below error and the container will not load. ### Deployment environment <!-- ========================================================================================= Preferably, use the `Generate Support String` button on the admin page's Diagnostics tab. That will auto-generate most of the info requested in this section. ========================================================================================= --> ### Your environment (Generated via diagnostics page) * Bitwarden_rs version: v1.19.0 * Web-vault version: v2.18.1 * Running within Docker: true * Internet access: true * Uses a proxy: false * DNS Check: true * Time Check: true * Domain Configuration Check: true * HTTPS Check: true * Database type: MySQL * Database version: [PLEASE PROVIDE DATABASE VERSION] * Clients used: * Reverse proxy and version: * Other relevant information: ### Config (Generated via diagnostics page) ```json { "_duo_akey": null, "_enable_duo": false, "_enable_email_2fa": true, "_enable_smtp": true, "_enable_yubico": true, "_ip_header_enabled": true, "admin_token": "***", "allowed_iframe_ancestors": "", "attachments_folder": "data/attachments", "authenticator_disable_time_drift": false, "data_folder": "data", "database_max_conns": 10, "database_url": "*****://*********:**********.*********.*********@***.***.**.**:****/************", "db_connection_retries": 15, "disable_2fa_remember": false, "disable_admin_token": false, "disable_icon_download": false, "domain": "*****://*********.****.****", "domain_origin": "*****://*********.****.****", "domain_path": "", "domain_set": true, "duo_host": null, "duo_ikey": null, "duo_skey": null, "email_attempts_limit": 3, "email_expiration_time": 600, "email_token_size": 6, "enable_db_wal": false, "extended_logging": true, "helo_name": null, "hibp_api_key": null, "icon_blacklist_non_global_ips": true, "icon_blacklist_regex": null, "icon_cache_folder": "data/icon_cache", "icon_cache_negttl": 259200, "icon_cache_ttl": 2592000, "icon_download_timeout": 10, "invitation_org_name": "XXXXXX", "invitations_allowed": true, "ip_header": "X-Real-IP", "log_file": "/data/bitwarden.log", "log_level": "Info", "log_timestamp_format": "%Y-%m-%d %H:%M:%S.%3f", "org_attachment_limit": null, "org_creation_users": "", "password_iterations": 100000, "reload_templates": false, "require_device_email": false, "rsa_key_filename": "data/rsa_key", "show_password_hint": true, "signups_allowed": false, "signups_domains_whitelist": "", "signups_verify": false, "signups_verify_resend_limit": 6, "signups_verify_resend_time": 3600, "smtp_accept_invalid_certs": false, "smtp_accept_invalid_hostnames": false, "smtp_auth_mechanism": null, "smtp_debug": false, "smtp_explicit_tls": false, "smtp_from": "*********@****.****", "smtp_from_name": "Bitwarden", "smtp_host": "**-**.*******.***", "smtp_password": "***", "smtp_port": 587, "smtp_ssl": true, "smtp_timeout": 15, "smtp_username": "********************************", "templates_folder": "data/templates", "use_syslog": false, "user_attachment_limit": null, "web_vault_enabled": true, "web_vault_folder": "web-vault/", "websocket_address": "0.0.0.0", "websocket_enabled": true, "websocket_port": 3012, "yubico_client_id": "47172", "yubico_secret_key": "***", "yubico_server": null } ``` Docker, here's the below information based on my 1.19 install <!-- The version number, obtained from the logs (at startup) or the admin diagnostics page --> <!-- This is NOT the version number shown on the web vault, which is versioned separately from bitwarden_rs --> <!-- Remember to check if your issue exists on the latest version first! --> * bitwarden_rs version: 1.20 <!-- How the server was installed: Docker image, OS package, built from source, etc. --> * Install method: Docker image * Clients used: <!-- web vault, desktop, Android, iOS, etc. (if applicable) --> N/A * Reverse proxy and version: <!-- if applicable --> N/A * MySQL/MariaDB or PostgreSQL version: <!-- if applicable --> 10.5.9 * Other relevant details: ### Steps to reproduce <!-- Tell us how to reproduce this issue. What parameters did you set (differently from the defaults) and how did you start bitwarden_rs? --> Just updated the container from current install ### Expected behaviour <!-- Tell us what you expected to happen --> Container will load ### Actual behaviour <!-- Tell us what actually happened --> I get the below error in the log and it just loops the error/fails to complete the load ### Troubleshooting data <!-- Share any log files, screenshots, or other relevant troubleshooting data --> Log: ``` /--------------------------------------------------------------------\ | Starting Bitwarden_RS | | Version 1.20.0 | |--------------------------------------------------------------------| | This is an *unofficial* Bitwarden implementation, DO NOT use the | | official channels to report bugs/features, regardless of client. | | Send usage/configuration questions or feature requests to: | | https://bitwardenrs.discourse.group/ | | Report suspected bugs/issues in the software itself at: | | https://github.com/dani-garcia/bitwarden_rs/issues/new | \--------------------------------------------------------------------/ FO] No .env file found. [WARNING] The following environment variables are being overriden by the config file, [WARNING] please use the admin panel to make changes to them: [WARNING] SIGNUPS_ALLOWED, ADMIN_TOKEN, SMTP_HOST, SMTP_SSL, SMTP_PORT, SMTP_FROM, SMTP_USERNAME, SMTP_PASSWORD Running migration 20210311190243 Executing migration script 20210311190243/up.sql [2021-03-29 12:34:53.936][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError. [CAUSE] QueryError( DatabaseError( __Unknown, "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")", ), ) Running migration 20210311190243 Executing migration script 20210311190243/up.sql [2021-03-29 12:34:54.947][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError. [CAUSE] QueryError( DatabaseError( __Unknown, "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")", ), ) Running migration 20210311190243 Executing migration script 20210311190243/up.sql [2021-03-29 12:34:55.958][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError. [CAUSE] QueryError( DatabaseError( __Unknown, "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")", ), ) Running migration 20210311190243 Executing migration script 20210311190243/up.sql [2021-03-29 12:34:56.968][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError. [CAUSE] QueryError( DatabaseError( __Unknown, "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")", ), ) Running migration 20210311190243 Executing migration script 20210311190243/up.sql [2021-03-29 12:34:57.978][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError. [CAUSE] QueryError( DatabaseError( __Unknown, "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")", ), ) Running migration 20210311190243 Executing migration script 20210311190243/up.sql [2021-03-29 12:34:58.988][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError. [CAUSE] QueryError( DatabaseError( __Unknown, "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")", ), ) Running migration 20210311190243 Executing migration script 20210311190243/up.sql [2021-03-29 12:34:59.999][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError. [CAUSE] QueryError( DatabaseError( __Unknown, "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")", ), ) Running migration 20210311190243 Executing migration script 20210311190243/up.sql [2021-03-29 12:35:01.009][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError. [CAUSE] QueryError( DatabaseError( __Unknown, "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")", ), ) Running migration 20210311190243 Executing migration script 20210311190243/up.sql [2021-03-29 12:35:02.020][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError. [CAUSE] QueryError( DatabaseError( __Unknown, "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")", ), ) Running migration 20210311190243 Executing migration script 20210311190243/up.sql [2021-03-29 12:35:03.030][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError. [CAUSE] QueryError( DatabaseError( __Unknown, "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")", ), ) Running migration 20210311190243 Executing migration script 20210311190243/up.sql [2021-03-29 12:35:04.039][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError. [CAUSE] QueryError( DatabaseError( __Unknown, "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")", ), ) Running migration 20210311190243 Executing migration script 20210311190243/up.sql [2021-03-29 12:35:05.049][bitwarden_rs::util][WARN] Can't connect to database, retrying: DieselMigError. [CAUSE] QueryError( DatabaseError( __Unknown, "Can\'t create table `bitwarden_rs`.`sends` (errno: 150 \"Foreign key constraint is incorrectly formed\")", ), ) ```
kerem closed this issue 2026-03-03 02:05:25 +03:00
Author
Owner

@BlackDex commented on GitHub (Mar 29, 2021):

During migrations foreign key checks are disabled. So this probably looks like some collation issue.

Please see: https://github.com/dani-garcia/bitwarden_rs/discussions/1492

There are some tips on how to solve this.

<!-- gh-comment-id:809353421 --> @BlackDex commented on GitHub (Mar 29, 2021): During migrations foreign key checks are disabled. So this probably looks like some collation issue. Please see: https://github.com/dani-garcia/bitwarden_rs/discussions/1492 There are some tips on how to solve this.
Author
Owner

@FuzzyMistborn commented on GitHub (Mar 29, 2021):

Thanks, that does seem like my issue but I've tried resetting the db character set to both utf8 and utf8mb4 without luck. Here are the commands I'm running in the DB, am I missing something?

ALTER DATABASE bitwarden_rs CHARACTER SET utf8 COLLATE utf8_general_ci;

ALTER DATABASE bitwarden_rs CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

<!-- gh-comment-id:809370255 --> @FuzzyMistborn commented on GitHub (Mar 29, 2021): Thanks, that does seem like my issue but I've tried resetting the db character set to both utf8 and utf8mb4 without luck. Here are the commands I'm running in the DB, am I missing something? `ALTER DATABASE bitwarden_rs CHARACTER SET utf8 COLLATE utf8_general_ci;` `ALTER DATABASE bitwarden_rs CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;`
Author
Owner

@BlackDex commented on GitHub (Mar 29, 2021):

DId you also checked the tables them self?

<!-- gh-comment-id:809370618 --> @BlackDex commented on GitHub (Mar 29, 2021): DId you also checked the tables them self?
Author
Owner

@FuzzyMistborn commented on GitHub (Mar 29, 2021):

Sorry I'm not really proficient in mariadb. How would I check that?

<!-- gh-comment-id:809376011 --> @FuzzyMistborn commented on GitHub (Mar 29, 2021): Sorry I'm not really proficient in mariadb. How would I check that?
Author
Owner

@FuzzyMistborn commented on GitHub (Mar 29, 2021):

Ah nevermind, figured it out. SHOW TABLE STATUS;. Looks like mine is still latin1_swedish_ci so I'll keep digging.

<!-- gh-comment-id:809381528 --> @FuzzyMistborn commented on GitHub (Mar 29, 2021): Ah nevermind, figured it out. `SHOW TABLE STATUS;`. Looks like mine is still `latin1_swedish_ci` so I'll keep digging.
Author
Owner

@BlackDex commented on GitHub (Mar 29, 2021):

So best way to fix this i think is this:

ALTER DATABASE `bitwarden_rs` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

After that convert all the tables.
Execute the following, and copy the output.

SELECT CONCAT('ALTER TABLE `', TABLE_NAME,'` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;') AS CharSetConvert
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA="bitwarden_rs"
AND TABLE_TYPE="BASE TABLE";

Copy/Paste the output from above between the following lines:

SET foreign_key_checks = 0;
-- Copy/Paste the output from above here
SET foreign_key_checks = 1;

Now, since all databases should be the same here is a sample with my output:

SET foreign_key_checks = 0;
ALTER TABLE `folders` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `invitations` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `__diesel_schema_migrations` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `users_collections` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `collections` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `devices` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `twofactor` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `sends` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `users` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `users_organizations` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `favorites` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `attachments` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `org_policies` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `ciphers` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `folders_ciphers` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `organizations` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ALTER TABLE `ciphers_collections` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
SET foreign_key_checks = 1;
<!-- gh-comment-id:809406232 --> @BlackDex commented on GitHub (Mar 29, 2021): So best way to fix this i think is this: ```mysql ALTER DATABASE `bitwarden_rs` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ``` After that convert all the tables. Execute the following, and copy the output. ```mysql SELECT CONCAT('ALTER TABLE `', TABLE_NAME,'` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;') AS CharSetConvert FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA="bitwarden_rs" AND TABLE_TYPE="BASE TABLE"; ``` Copy/Paste the output from above between the following lines: ```mysql SET foreign_key_checks = 0; -- Copy/Paste the output from above here SET foreign_key_checks = 1; ``` Now, since all databases should be the same here is a sample with my output: ```mysql SET foreign_key_checks = 0; ALTER TABLE `folders` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE `invitations` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE `__diesel_schema_migrations` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE `users_collections` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE `collections` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE `devices` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE `twofactor` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE `sends` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE `users` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE `users_organizations` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE `favorites` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE `attachments` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE `org_policies` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE `ciphers` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE `folders_ciphers` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE `organizations` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE `ciphers_collections` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; SET foreign_key_checks = 1; ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vaultwarden#1001
No description provided.