Pythagora-io / gpt-pilot

The first real AI developer
Other
31.1k stars 3.12k forks source link

[BUG]: no schema migrations, requiring users to wipe the database and lose the projects whenever database schema is changed #410

Open dsitnik opened 9 months ago

dsitnik commented 9 months ago

When using skip_until_dev_step I get the following error:

---------- GPT PILOT EXITING WITH ERROR ----------
Traceback (most recent call last):
  File "/home/dario/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 3251, in execute_sql
    cursor.execute(sql, params or ())
sqlite3.OperationalError: no such column: feature.previous_step

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dario/gpt-pilot/pilot/main.py", line 77, in <module>
    project.start()
  File "/home/dario/gpt-pilot/pilot/helpers/Project.py", line 141, in start
    self.developer.start_coding()
  File "/home/dario/gpt-pilot/pilot/helpers/agents/Developer.py", line 66, in start_coding
    self.implement_task(i, dev_task)
  File "/home/dario/gpt-pilot/pilot/helpers/agents/Developer.py", line 103, in implement_task
    response = convo_dev_task.send_message('development/parse_task.prompt', {
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dario/gpt-pilot/pilot/helpers/AgentConvo.py", line 71, in send_message
    delete_all_subsequent_steps(self.agent.project)
  File "/home/dario/gpt-pilot/pilot/database/database.py", line 369, in delete_all_subsequent_steps
    delete_subsequent_steps(DevelopmentSteps, app, project.checkpoints['last_development_step'])
  File "/home/dario/gpt-pilot/pilot/database/database.py", line 380, in delete_subsequent_steps
    delete_subsequent_steps(Model, app, subsequent_step)
  File "/home/dario/gpt-pilot/pilot/database/database.py", line 380, in delete_subsequent_steps
    delete_subsequent_steps(Model, app, subsequent_step)
  File "/home/dario/gpt-pilot/pilot/database/database.py", line 380, in delete_subsequent_steps
    delete_subsequent_steps(Model, app, subsequent_step)
  [Previous line repeated 20 more times]
  File "/home/dario/gpt-pilot/pilot/database/database.py", line 384, in delete_subsequent_steps
    Feature.delete().where(Feature.previous_step == subsequent_step).execute()
  File "/home/dario/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 1971, in inner
    return method(self, database, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dario/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 2042, in execute
    return self._execute(database)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dario/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 2560, in _execute
    cursor = database.execute(self)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dario/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 3259, in execute
    return self.execute_sql(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dario/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 3249, in execute_sql
    with __exception_wrapper__:
  File "/home/dario/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 3019, in __exit__
    reraise(new_type, new_type(exc_value, *exc_args), traceback)
  File "/home/dario/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 192, in reraise
    raise value.with_traceback(tb)
  File "/home/dario/gpt-pilot/pilot-env/lib/python3.11/site-packages/peewee.py", line 3251, in execute_sql
    cursor.execute(sql, params or ())
peewee.OperationalError: no such column: feature.previous_step
senko commented 9 months ago

Can you try removing the sqlite database (gpt-pilot file in the gpt-pilot/pilot/ directory of your GPT Pilot installation), recreating it with python db_init.py (making sure you've activated the virtual environment gpt-pilot/pilot-env/bin/activate and that you're in the gpt-pilot/pilot/ folder)?

Note that this will remove all previous projects as a side effect (since it's erasing and creating a new empty database).

dsitnik commented 9 months ago

@senko Unfortunately, I am too deep in my project to restart everything. Is there any other solution?

dsitnik commented 9 months ago

@senko temporary fix by reverting back to commit 2e651c465cf8bcc2900338a8656f79d437eead41

git checkout 2e651c465cf8bcc2900338a8656f79d437eead41