static planning

This commit is contained in:
Bastien COIGNOUX
2025-07-14 17:44:07 +02:00
parent 62c6bb5fa5
commit 9fad10e7b7
3 changed files with 177 additions and 0 deletions

View File

@ -0,0 +1,46 @@
// scripts/init-db.ts
import Database from 'better-sqlite3';
import { mkdirSync, existsSync } from 'fs';
if (!existsSync('data')) {
mkdirSync('data');
}
const db = new Database('data.db');
db.exec(`
DROP TABLE IF EXISTS tasks;
DROP TABLE IF EXISTS links;
CREATE TABLE tasks (
id INTEGER PRIMARY KEY AUTOINCREMENT,
text TEXT NOT NULL,
start TEXT NOT NULL,
end TEXT NOT NULL,
duration INTEGER,
progress INTEGER,
type TEXT,
parent INTEGER,
lazy BOOLEAN DEFAULT 0 -- ✅ Ajout ici
);
CREATE TABLE links (
id INTEGER PRIMARY KEY AUTOINCREMENT,
source INTEGER,
target INTEGER,
type TEXT
);
`);
// table pour les ressources
db.exec(`
CREATE TABLE IF NOT EXISTS resource_planning (
id INTEGER PRIMARY KEY AUTOINCREMENT,
ressource TEXT NOT NULL,
profil TEXT NOT NULL,
date TEXT NOT NULL,
disponibilite REAL NOT NULL
);
`);
console.log('✅ Base de données initialisée avec succès.');