Error : no such table : main.task_has_subtasks

Hi,

I just see Kanboard yesterday and I want to test it for my association, it looks great !
I’ve install it quickly (zip) on Wampserver for testing on my computer. A problem occure when I create a project. I’ve delete all and reinstall this morning but same error :
I can create a subtask but I can’t look and modify it after :
Internal Error: SQL Error: SQLSTATE[HY000]: General error: 1 no such table: main.task_has_subtasks

I just look in the db.sqlite and there’s no table name ‘task_has_subtasks’. This error it’s because of my too quick installation on a “false server” or somebody have the same problem ?

Thanks !

Version de l'application : master.938d62aec70a3f4d76b51d503a84a68711535a28
Version de PHP : 7.2.14
PHP SAPI : apache2handler
Client HTTP : cURL
Version du système d'exploitation : Windows NT 10.0
Type de base de données : sqlite
Version de la base de donnée : 3.20.1
Navigateur web : Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0

I see that : https://github.com/kanboard/kanboard/issues/4736
need to wait I suppose ?

well, the error is correct, there shouldn’t be such a table…it was renamed to “subtasks” like 6 years ago.

Version de l'application : master.938d62aec70a3f4d76b51d503a84a68711535a28

That’s not a version, can’t really help you there. Try using an actual release: Release Kanboard 1.2.18 · kanboard/kanboard · GitHub

Yes, perhaps I don’t take the last version, I’m a beginner with github…
I’ve take the zip from here : https://github.com/kanboard/kanboard → the 7 first characters (master.938d62a) don’t mean the commit ?

I’ve test with the zip from 1.2.18 : https://github.com/kanboard/kanboard/releases/tag/v1.2.18

Version de l’application : 1.2.18

And I’ve the same trouble…

always install from a release, just makes it easier. (it does appear that is the last commit in the master repo)

are you using an old DB? I would delete the DB, and let it migrate a new one. doesn’t really make sense to me.

I don’t know… I’ve take zip file, dezip on the wampserver and it works… I presume the DB is the db.sqlite in data folder

I’ve make the same test with the 1.2.16 and all is fine, my sub-task and his timer works fine !

@creecros
Internal Error: SQL Error: SQLSTATE[HY000]: General error: 1 no such table: main.task_has_subtasks

It’s confirmed with a fresh install of 1.2.18 from stable release

No plugins installed.

Replicate:

  1. Fresh install login with admin/admin
  2. Create new project
  3. Create new task
  4. Create new sub-task
  5. Clicking the subtask checkbox KABOOOOOOOOOOOOM
    Internal Error: SQL Error: SQLSTATE[HY000]: General error: 1 no such table: main.task_has_subtasks

Interesting, I just spun up a fresh install, and I don’t have said issue.

Are you using the same github repo? link above?
Mine was installed straight from the zip file. Maybe legacy stuff in there?

it shows me pull the image, kanboard/kanboard:v1.2.18

I use docker. the docker image is built from the github repo for the tagged v1.2.18 repo. So yes, it is the github repo for v1.2.18.

Just a bump. I have tried this again today. Deleted the data/db.sqlite and web.config. Uploaded the web.config from your 1.2.18 zip file to redo the db. The db was re-done and I get the error:
Internal Error: SQL Error: SQLSTATE[HY000]: General error: 1 no such table: main.task_has_subtasks

Could you install this via ftp and zip file instead of docker?

Ok, it’s working now by changing the db driver to mysql and re-doing the db in mysql.
Actually I prefer mysql maria flavour.

Thanks for the differents tests but I don’t know how to do that…

You need to create a mysql db with phpmyadmin and then edit the config-default.php file… rename it to config.php.
Then edit the file and look for the mysql entries… insert your db name, db username and db password for that user.

// Database driver: sqlite, mysql or postgres (sqlite by default)
define(‘DB_DRIVER’, ‘mysql’);

// Mysql/Postgres username
define(‘DB_USERNAME’, ‘your-user’);

// Mysql/Postgres password
define(‘DB_PASSWORD’, ‘your-user-passsword’);

// Mysql/Postgres hostname
define(‘DB_HOSTNAME’, ‘localhost’);

// Mysql/Postgres database name
define(‘DB_NAME’, ‘your-db-name’);

I found that in SQLITE the subtask_time_tracking table has a wrong foreign key constraint. The constraints references the no-longer-existing table task_has_subtasks. If I understood it correctly, this was changed to table “subtasks” a while ago.
The contraints can’t be changed, but the table can be cloned with a new contraint:

ALTER TABLE subtask_time_tracking RENAME TO subtask_time_tracking_old;

CREATE TABLE subtask_time_tracking (
    "id"	INTEGER,
    "user_id"	INTEGER NOT NULL,
    "subtask_id"	INTEGER NOT NULL,
    "start"	INTEGER DEFAULT 0,
    "end"	INTEGER DEFAULT 0,
    "time_spent"	REAL DEFAULT 0,
    FOREIGN KEY("user_id") REFERENCES "users"("id") ON DELETE CASCADE,
    FOREIGN KEY("subtask_id") REFERENCES "subtasks"("id") ON DELETE CASCADE
);

INSERT INTO subtask_time_tracking SELECT * FROM subtask_time_tracking_old;

This worked in my tests and I could then update the subtask status.
I recommend doing backups of the database before playing around with it.

1 Like

Thanks for the tip, I tried it and could correct this error.

This error is present in the last release, I made a new install with SQLITE from https://github.com/kanboard/kanboard/archive/refs/tags/v1.2.18.tar.gz