Docker first install DB migration fail

Hello, during the migration there is no default value and fail. It might be related to mariaDB. Running latest version. Any help? Running the SQL with

created TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',

Might solve the issue

> 2022-10-06T07:26:25Z [INFO] [Entrypoint]: Initialising Invoice Ninja...


   INFO  Configuration cached successfully.  



   INFO  Caching the framework bootstrap files.  


  config ........................................................... 50ms DONE

  routes .......................................................... 105ms DONE



   INFO  Running migrations.  


  2022_05_18_162443_create_schedulers_table ......................... 6ms FAIL


In Connection.php line 759:

                                                                               

  SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default val  

  ue for 'scheduled_run' (SQL: create table `schedulers` (`id` bigint unsigne  

  d not null auto_increment primary key, `paused` tinyint(1) not null default  

   '0', `is_deleted` tinyint(1) not null default '0', `repeat_every` varchar(  

  191) not null, `start_from` timestamp not null, `scheduled_run` timestamp n  

  ot null, `company_id` bigint unsigned not null, `created_at` timestamp null  

  , `updated_at` timestamp null, `deleted_at` timestamp null) default charact  

  er set utf8mb4 collate 'utf8mb4_unicode_ci' engine = InnoDB)                 

                                                                               


In Connection.php line 544:

                                                                               

  SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default val  

  ue for 'scheduled_run'

Hi,

@david any thoughts?

Tried running the SQL and it works well, I don’t know what’s wrong

but if I create it manualy, if there was a way to skip the check and carry on would be great :slight_smile:

create table `schedulers` (`id` bigint unsigned not null auto_increment primary key, 
`paused` tinyint(1) not null default  '0', 
`is_deleted` tinyint(1) not null default '0',
 `repeat_every` varchar(191) not null, `start_from` timestamp not null,
 `scheduled_run` timestamp not null,
 `company_id` bigint unsigned not null,
 `created_at` timestamp null,
 `updated_at` timestamp null,
 `deleted_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci' engine = InnoDB

@flo

Which version of MariaDB are you using?

It is unusual to see this, but it appears your DB may be in a strict mode.

I’ll update the migrations to include ->nullable() so you won’t have this issue. I’ll tag a new release shortly

MySQL version: 5.5.5-10.9.3-MariaDB-1:10.9.3+maria~ubu2204 through PHP extension MySQLi

Thank you David

@david Thank you David, I tested and it looks like it’s going through for this one, but later fail for the the following :

SQLSTATE[HY000]: General error: 1364 Field 'slack_webhook_url' doesn't have  

   a default value   

@flo

I think your Database is in Strict Mode, you’ll hit hundreds of these each time we set a column to nullable.

The easiest solution would be to turn your DB strict_mode off

https://manuals.gfi.com/en/helpdesk/admin/content/faqs/155.disabling-mysql-strict-mode-on-the-server.htm

@david c’etais ca! Merci! Je me rapproche de le faire tourner :slight_smile:

Don’t know why I wrote in French sorry, my head is confused.

Thank you

1 Like

Good afternoon guys.

I have the same issue with a docker image installation. Database is running on a separate server. Maria DB version 10.5.18

I ensure that the database is not in strict mode as suggested:

Creating the docker image is next while following the logs:

The process runs until it fails with the following:
Database\Seeders\DesignSeeder 
 RUNNING
Database\Seeders\DesignSeeder 
 126.65 ms DONE

Sat, 03 Dec 2022 12:24:16 +0000 Create Single Account


In Connection.php line 760:

SQLSTATE[HY000]: General error: 1364 Field ‘slack_webhook_url’ doesn’t have
a default value (SQL: insert into companies (company_key, ip, db,
settings, is_large, default_password_timeout, enabled_modules, cus tom_fields, account_id, portal_domain, portal_mode, updated_at, c reated_at) values (8pBeKsZcDJmYUF539CovZkdGW0LXJH4d, 212.241.51.223, mysql
, {“auto_archive_invoice”:false,“qr_iban”:“”,“besr_id”:“”,“lock_invoices”:"

and ends with:
alse,“client_portal_under_payment_minimum”:0,“client_portal_allow_over_paym
ent”:false,“use_credits_payment”:“off”,“hide_empty_columns_on_pdf”:false,“e
mail_from_name”:“”,“auto_archive_invoice_cancelled”:false,“vendor_portal_en
able_uploads”:false,“send_email_on_mark_paid”:false}, 0, 1800000, 32767, {}
, 1, http://somedomain.com, domain, 2022-12-03 12:24:16.393227, 20
22-12-03 12:24:16.393227))

In Connection.php line 545:

SQLSTATE[HY000]: General error: 1364 Field ‘slack_webhook_url’ doesn’t have
a default value

2022-12-03T12:24:17Z [INFO] [Entrypoint]: Initialising Invoice Ninja


INFO Configuration cached successfully.

INFO Caching the framework bootstrap files.

config 
 63ms DONE
routes 
 145ms DONE

It automatically restarts (as that is what I told it to do), but I am unable to access the port specified in a web page.

Any assistance would be greatly appreciated.

Try turning off strict mode on the DB

you can force this in the .env file with

DB_STRICT=false

Hi @david, Thank you for the reply, however this is already set on the docker started. I also tested this with the latest docker image and still giving the same issue as well.

@david,

I had a look at the table which was created by the migration and the values, and the issue might be
MariaDB [abaconivndb]> show columns from companies;
±---------------------------------±--------------------------------------±-----±----±----------±---------------+
| Field | Type | Null | Key | Default | Extra |
±---------------------------------±--------------------------------------±-----±----±----------±---------------+
| slack_webhook_url | varchar(191) | NO | | NULL | |
| google_analytics_key | varchar(191) | NO | | NULL | |

Both the fields are set to NULL no with no default value. I have altered the field creation in the migration to:
$table->string(‘slack_webhook_url’)->nullable();

It then passed by and gave a similar issue with field calculate_expense_tax_by_amount in companies

you’ll hit hundreds of these, the best way is to disable strict mode.