Sindbad~EG File Manager

Current Path : /home/beeson/public_html/WebMathXpert/ThreeBodyWeb/
Upload File :
Current File : //home/beeson/public_html/WebMathXpert/ThreeBodyWeb/InitDatabase.php

<?php
// initDatabase.php
// This script creates (or updates) the SQLite database with the required tables.

$dbFile = 'ThreeBodyDatabase.db';
$db = new SQLite3($dbFile);

// Create the documents table.
$db->exec("
    CREATE TABLE IF NOT EXISTS documents (
        DocumentNumber INTEGER PRIMARY KEY AUTOINCREMENT,
        nbodies INTEGER NOT NULL,
        caption VARCHAR(128),
        png_filename TEXT,
        tmax INTEGER DEFAULT 10000,
        integrationMethod VARCHAR(32) DEFAULT 'rk4',
        date_created TIMESTAMP DEFAULT CURRENT_TIMESTAMP
    );
");

// Create the bodies table.
$db->exec("
    CREATE TABLE IF NOT EXISTS bodies (
        BodyNumber INTEGER PRIMARY KEY AUTOINCREMENT,
        DocumentNumber INTEGER NOT NULL,
        mass REAL NOT NULL,
        color TEXT NOT NULL,
        r REAL NOT NULL,
        x0 REAL NOT NULL,
        y0 REAL NOT NULL,
        p0 REAL NOT NULL,
        q0 REAL NOT NULL,
        FOREIGN KEY(DocumentNumber) REFERENCES documents(DocumentNumber)
    );
");

echo "Database initialized successfully.";
?>

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists