infobyte / faraday

Open Source Vulnerability Management Platform
https://www.faradaysec.com
GNU General Public License v3.0
4.72k stars 875 forks source link

Migration Error: (psycopg2.errors.UndefinedTable) relation "vulnerability" does not exist #462

Closed fajarhide closed 1 year ago

fajarhide commented 1 year ago

Issue Type

Faraday version

Found in version 4.3.2 but reproduced it with docker versionlatest tag

Component Name

Error Migration relation vulnerability does not exist

Steps to reproduce

Reproduce using docker-composer

$ wget https://raw.githubusercontent.com/infobyte/faraday/master/docker-compose.yaml
$ docker-compose up

Expected results

Got error from docker logs

Thu Jan 26 10:58:22 UTC 2023 Using existing server.ini
Thu Jan 26 10:58:25 UTC 2023 Running migrations ...
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade  -> e61afb450465, Add custom fields
Migration failed! (psycopg2.errors.UndefinedTable) relation "vulnerability" does not exist

[SQL: ALTER TABLE vulnerability ADD COLUMN custom_fields JSONB]
(Background on this error at: http://sqlalche.me/e/13/f405)
ERROR [faraday.manage] Migration Error: (psycopg2.errors.UndefinedTable) relation "vulnerability" does not exist

[SQL: ALTER TABLE vulnerability ADD COLUMN custom_fields JSONB]
(Background on this error at: http://sqlalche.me/e/13/f405)

Should be solutions

migration should run create table first before running alter, right ? but when i'm create table manually one by one it solved, but not automatically when we running docker

when I checked the database, only the following two tables were successfully created automatically in the database

alembic_version
custom_fields_schema

Screenshots

Screen Shot 2023-01-26 at 18 01 25