Error sql_require_primary_key DigitalOcean Managed Databases

I’d like to use a DigitalOcean managed MySQL database for my InvoiceNinja v5 install. I’m running InvoiceNinja (via Docker) and attempting to do the initial setup. I’m getting an exception stating that that password_resets table doesn’t have a primary key, and DigitalOcean’s managed MySQL database requires that all tables have a primary key for replication purposes due to the “sql_require_primary_key” sql mode being set.

I’d rather not disable this sql mode if possible- as I’d like to have the ability to set up replication on this mysql cluster in the future if needed. Can InvoiceNinja setup work on servers that require primary keys like DO? I was going to raise a GitHub issue but thought I’d ask here first.

Configuration cache cleared!
Configuration cached successfully!
Configuration cache cleared!
Configuration cached successfully!
Route cache cleared!
Routes cached successfully!
Files cached successfully!
Migrating: 2014_10_12_100000_create_password_resets_table

In Connection.php line 712:
                                                                                                                       
SQLSTATE[HY000]: General error: 3750 Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary key to the table or unset this variable to avoid this message. Note that tables without a primary key can cause performance problems in row-based replication, so please consult your DBA before changing this setting. (SQL: create table `password_resets` (`email` varchar(128) not null, `token` varchar(255) not null, `created_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci' engine = InnoDB)                                                                                                        
                                                                                                   
In Connection.php line 501:
                                                                                                   
SQLSTATE[HY000]: General error: 3750 Unable to create or change a table without a primary key, when the system variable 'sql_require_primary_key' is set. Add a primary key to the table or unset this variable to avoid this message. Note that tables without a primary key can cause performance problems in row-based replication, so please consult your DBA before changing this setting.

Hi,

@david do you have any thoughts on this?

@muncherelli

Looks like this has caught a few people out, the link above describes some ways to work around this.