Creating a custom database

Hello all,

I’ve been giving my best to setup dhtmlx gantt but I’ve reached my limit so I though I’d ask:
I’ve been using the examples to try to create a custom database to auto save/update and have
a user field and a priority field.

My base example has been using the connector_xml.php and sqlite3.

I am creating a new database as follows:

$res->exec('CREATE TABLE gantt_links (id INTEGER PRIMARY_KEY, source INTEGER NOT_NULL, target INTEGER NOT_NULL, type varchar NOT_NULL)');
$res->exec('CREATE TABLE gantt_tasks (id INTEGER PRIMARY_KEY, text varchar NOT_NULL, start_date datetime NOT_NULL, duration INTEGER NOT_NULL, progress float NOT_NULL, user varchar NOT_NULL, type varchar NOT_NULL, sortorder INTEGER NOT_NULL, parent INTEGER NOT_NULL)');

The problem that I’m having is that the ID never auto-increments, it stays empty and from what I understand this is required for the functionality of the project to work… I’ve changed the id to AUTO_INCREMENT NOT_NULL and added PRIMARY KEY(id) at the end but none made it auto-increment and I’m at a loss on what to do next as without it, nothing shows or updates.

PS: I have updated connector.php to
$gantt->render_table(“gantt_tasks”,“id”,“start_date,duration,text,progress,user,type,sortorder,parent”);

The ID field must be auto-increment.
The next is config which works for me ( tested with SQLite3 ), you can change any fields after “duration”

[code]CREATE TABLE “gantt_tasks”(
“id” Integer PRIMARY KEY AUTOINCREMENT,
“text” Text,
“start_date” Numeric,
“duration” Integer,
“progress” Real,
“sortorder” Integer,
“parent” Integer,
“deadline” DateTime,
“planned_start” DateTime,
“planned_end” DateTime );

CREATE TABLE “gantt_links”(
“id” Integer PRIMARY KEY AUTOINCREMENT,
“source” Integer,
“target” Integer,
“type” Text );
[/code]

If some problem still occurs, try to enable logs for connector

$gantt->enable_log("some.txt");
$gantt->render_table(...

It doesn’t seem to like AUTOINCREMENT, it only accepts AUTO_INCREMENT

PHP Warning: SQLite3::exec(): near "AUTOINCREMENT": syntax error

when I added the " " in the names it actually worked great!