quarkslab / irma

IRMA is an asynchronous & customizable analysis system for suspicious files.
https://irma.quarkslab.com
Apache License 2.0
269 stars 55 forks source link

column irma_probeResult.doc does not exist #37

Closed sambenas closed 7 years ago

sambenas commented 7 years ago

Manual install of version 1.5.3. File upload returns api error with this in the frontend_api.log file:

ProgrammingError: (psycopg2.ProgrammingError) column irma_probeResult.doc does not exist

LINE 1: ...rma_probeResult".name AS "irma_probeResult_name", "irma_prob...
                                                             ^
 [SQL: 'SELECT "irma_probeResult".id AS "irma_probeResult_id", "irma_probeResult".type AS "irma_probeRes
ult_type", "irma_probeResult".name AS "irma_probeResult_name", "irma_probeResult".doc AS "irma_probeResu
lt_doc", "irma_probeResult".status AS "irma_probeResult_status", "irma_probeResult".id_file AS "irma_pro
beResult_id_file", anon_1."irma_fileWeb_id" AS "anon_1_irma_fileWeb_id" \nFROM (SELECT "irma_fileWeb".id
 AS "irma_fileWeb_id" \nFROM "irma_fileWeb" \nWHERE %(param_1)s = "irma_fileWeb".id_scan) AS anon_1 JOIN
 "irma_probeResult_fileWeb" AS "irma_probeResult_fileWeb_1" ON anon_1."irma_fileWeb_id" = "irma_probeRes
ult_fileWeb_1".id_fw JOIN "irma_probeResult" ON "irma_probeResult".id = "irma_probeResult_fileWeb_1".id_
pr ORDER BY anon_1."irma_fileWeb_id"'] [parameters: {'param_1': 5}]
Exception <class 'sqlalchemy.exc.ProgrammingError'>:(psycopg2.ProgrammingError) column irma_probeResult.
doc does not exist

Command alembic current on frontend node produces:

INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
56608def7269 (head)

Is a migration file missing? In the frontend/extras/migrations/versions/ directory I have: 2cc69d5c53eb_db_revision_creation.py 56608def7269_version_1_5_2.py 430a70c8aa21_version_1_2_1.py
eb7141efd75a_version_1_3_0.py

Table irma_probeRresult in postgres shows the following fields: id | type | name | nosql_id | status | id_file

ch0k0bn commented 7 years ago

We introduced JSONB column named irma_probeResult. doc in 1.5.0 but didnt published a migration script (pretty easy for the structure migration but pretty hard for the data migration mongodb ->this new column). It is possible to achieve but with efforts so we announced that migration from or to 1.5.0 will not work (1.5.0 changelog) Manual install normally create the db from scratch directly with the good structure, if you don't have any important data you could just drop the database "irma-frontend" (default name) and recreate it, restarting the frontend_api will recreate the database with the correct structure. Sorry for the inconvenience.

sambenas commented 7 years ago

Thank you for the response. It was a fresh install so there was no data yet. I just took a pg_dump from one of the prebuilt 1.5 images and got it working.

ch0k0bn commented 7 years ago

Good.