Closed joglomedia closed 2 weeks ago
The error SQLSTATE[HY000]: General error: 1 Cannot add a NOT NULL column with default value NULL
shows that you are assigning NULL
value to a column which is Not NULL
type.
Share the code of the update_storage_providers_table.php
migration here so I can assist you further :)
The error
SQLSTATE[HY000]: General error: 1 Cannot add a NOT NULL column with default value NULL
shows that you are assigningNULL
value to a column which isNot NULL
type. Share the code of theupdate_storage_providers_table.php
migration here so I can assist you further :)
The code available in database/migrations
Btw, this issue has long recognized as bug due to SQLite differnce behavour compared to other SQL database engine
https://sqlite.org/forum/info/ffa52447275d247a
The issue itself has been patched since SQLite v3.37.0
https://www.sqlite.org/changes.html
I think, we don't need to change the code, since the current migration code working fine on PostgreSQL (although Vito itself doesn't officially support Postgres)
I don't think the installation process you have to reproduce this issue is valid.
the error appears if you already have some rows in the storage_providers table which in case of new installation I don't think there must be any rows in that table!
Also its too early to raise any installation issues on v2 as it doesn't have a release yet. so lets wait for the first release (beta) and then test this part.
I could reproduce this on ubuntu 20.04 but still, vito itself must be installed on ubuntu 22.04 or higher versions
Migration Failed on Ubuntu 20.04:
SQLSTATE[HY000]: General error: 1 Cannot add a NOT NULL column with default value NULL
Describe the bug Installing Vito v2.x on Ubuntu 20.04 using the standard installation script with the default SQLite3 library from the Ubuntu repository failed to complete the Laravel migrations.
In Connection.php line 813:
SQLSTATE[HY000]: General error: 1 Cannot add a NOT NULL column with default value NULL (Connection: sqlite, SQL: alter table "storage_providers" add column "user_id" integer not null)
In Connection.php line 565:
SQLSTATE[HY000]: General error: 1 Cannot add a NOT NULL column with default value NULL
To Reproduce Steps to reproduce the behavior:
Ubuntu 20.04
instance from your vps/cloud server provider (I use Amazon Lightsail)git clone -b v2.x https://github.com/vitodeploy/vito.git
scripts/install.sh
Expected behavior Laravel database successfully migrated, default admin user created.
Screenshots
Additional context Operating System:
SQLite3 library (default Ubuntu 20.04 repository packed with old version 3.31.1)
Proposed Solution
The only solution I found was to build the latest version of SQLite3 (at least version 3.37.0, as used by Jammy) from source. Here I write a function to install SQLite3 from source:
I'm currently working on improving the
scripts/install.sh
script for Vito v2.x. Related issue #320