AmpersandTarski / Ampersand

Build database applications faster than anyone else, and keep your data pollution free as a bonus.
http://ampersandtarski.github.io/
GNU General Public License v3.0
40 stars 8 forks source link

Correct script fails to start up a database. #1413

Open stefjoosten opened 1 year ago

stefjoosten commented 1 year ago

What happened

Consider the following Ampersand script, which I'm running FROM ampersandtarski/prototype-framework:v1.14:

CONTEXT Switch_demo

REPRESENT Bool TYPE BOOLEAN

RELATION flip[SESSION*Bool] [UNI]

INTERFACE switch : "_SESSION"[SESSION] BOX
   [ flipje : flip
   ]
ENDCONTEXT

When running it, this is what I got: afbeelding I can press the "Reinstall" button as often as I want, but the result stays the same.

What I expected

I expected that Ampersand would at least generate a database

Steps to reproduce

  1. docker compose build
  2. docker compose up -d
  3. in my browser, navigate to localhost
  4. press "Reinstall application"

Symptoms

I have inspected the log file and extracted the "hot portion" out of it. I sheds some light on the matter because it shows that the contents of relation flip is being deleted.

prototype  | [2023-05-30 08:13:35] APPLICATION.DEBUG: Session id set to: 2e360cc0367b2858b0d7023819263bce [] {"request_id":"ea5ab6942a"}
prototype  | [2023-05-30 08:13:35] DATABASE.DEBUG: SELECT "SESSION" FROM "SESSION" WHERE "SESSION" = '2e360cc0367b2858b0d7023819263bce' [] {"request_id":"ea5ab6942a"}
prototype  | [2023-05-30 08:13:35] DATABASE.DEBUG: SELECT "SESSION" as "src", "lastAccess" as "tgt" FROM "SESSION" WHERE "SESSION" = '2e360cc0367b2858b0d7023819263bce' AND "lastAccess" IS NOT NULL [] {"request_id":"ea5ab6942a"}
prototype  | [2023-05-30 08:13:35] APPLICATION.DEBUG: Session expired [] {"request_id":"ea5ab6942a"}
prototype  | [2023-05-30 08:13:35] APPLICATION.DEBUG: Resetting session [] {"request_id":"ea5ab6942a"}
prototype  | [2023-05-30 08:13:35] CORE.DEBUG: Delete atom 2e360cc0367b2858b0d7023819263bce[SESSION] from plug [] {"request_id":"ea5ab6942a"}
prototype  | [2023-05-30 08:13:35] TRANSACTION.INFO: Opening transaction: 339347433 [] {"request_id":"ea5ab6942a"}
prototype  | [2023-05-30 08:13:35] TRANSACTION.DEBUG: Mark concept 'SESSION' as affected concept [] {"request_id":"ea5ab6942a"}
prototype  | [2023-05-30 08:13:35] TRANSACTION.DEBUG: Add storage: MySQL database prototype-db - Switch_demo [] {"request_id":"ea5ab6942a"}
prototype  | [2023-05-30 08:13:35] DATABASE.INFO: Start mysql database transaction for Transaction 339347433 [] {"request_id":"ea5ab6942a"}
prototype  | [2023-05-30 08:13:35] DATABASE.DEBUG: START TRANSACTION [] {"request_id":"ea5ab6942a"}
prototype  | [2023-05-30 08:13:35] DATABASE.DEBUG: DELETE FROM "SESSION" WHERE "SESSION" = '2e360cc0367b2858b0d7023819263bce' LIMIT 1 [] {"request_id":"ea5ab6942a"}
prototype  | [2023-05-30 08:13:35] CORE.INFO: Atom deleted: 2e360cc0367b2858b0d7023819263bce[SESSION] [] {"request_id":"ea5ab6942a"}
prototype  | [2023-05-30 08:13:35] CORE.DEBUG: Deleting all links in relation 'flip[SESSION*Bool]' with src '2e360cc0367b2858b0d7023819263bce[SESSION]' [] {"request_id":"ea5ab6942a"}
prototype  | [2023-05-30 08:13:35] TRANSACTION.DEBUG: Mark relation 'flip[SESSION*Bool]' as affected relation [] {"request_id":"ea5ab6942a"}
prototype  | [2023-05-30 08:13:35] DATABASE.DEBUG: UPDATE "SESSION" SET "flip" = NULL WHERE "SESSION" = '2e360cc0367b2858b0d7023819263bce' [] {"request_id":"ea5ab6942a"}
prototype  | [2023-05-30 08:13:35] API.ERROR: <h4>Error/Exception</h4><div><strong>Type:</strong> Ampersand\Exception\NotInstalledException</div><div><strong>Message:</strong> Unknown column &#039;flip&#039; in &#039;field list&#039;</div><div><strong>File:</strong> /var/
.... log cut off ...