diff --git a/svar-gantt-app/README.md b/svar-gantt-app/README.md index b5b2950..2a10492 100644 --- a/svar-gantt-app/README.md +++ b/svar-gantt-app/README.md @@ -36,3 +36,11 @@ npm run build You can preview the production build with `npm run preview`. > To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment. + + + +Pour créer la BDD en local : +npm run init-db + +Pour lancer l'application +npm run dev \ No newline at end of file diff --git a/svar-gantt-app/data.db b/svar-gantt-app/data.db index a0884b3..7a2ca9a 100644 Binary files a/svar-gantt-app/data.db and b/svar-gantt-app/data.db differ diff --git a/svar-gantt-app/scripts/init-db.ts b/svar-gantt-app/scripts/init-db.ts deleted file mode 100644 index ae6f327..0000000 --- a/svar-gantt-app/scripts/init-db.ts +++ /dev/null @@ -1,35 +0,0 @@ -// 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 - ); -`); - -console.log('✅ Base de données initialisée avec succès.'); diff --git a/svar-gantt-app/src/lib/server/db.ts b/svar-gantt-app/src/lib/server/db.ts index 2ce02a0..ac3f59b 100644 --- a/svar-gantt-app/src/lib/server/db.ts +++ b/svar-gantt-app/src/lib/server/db.ts @@ -4,4 +4,14 @@ import { resolve } from 'path'; // 📁 chemin absolu vers la BDD SQLite const db = new Database(resolve('data.db')); +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 + ); +`); + export default db; diff --git a/svar-gantt-app/src/routes/+layout.svelte b/svar-gantt-app/src/routes/+layout.svelte index 71fef79..3a3d6a5 100644 --- a/svar-gantt-app/src/routes/+layout.svelte +++ b/svar-gantt-app/src/routes/+layout.svelte @@ -25,6 +25,7 @@ 🏠 📅 📂 + 📅 ⚙️