gitea init

This commit is contained in:
skryper
2025-10-08 21:28:30 +04:00
commit d4651a423d
2518 changed files with 522832 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
<?php
// უსაფრთხო cleanup script install დირექტორიის წასაშლელად
if (!file_exists(__DIR__ . '/install.lock')) {
http_response_code(403);
die('ინსტალაცია არ არის დასრულებული.');
}
function deleteDirectory($dir) {
if (!file_exists($dir)) return true;
if (!is_dir($dir)) return unlink($dir);
foreach (scandir($dir) as $item) {
if ($item == '.' || $item == '..') continue;
if (!deleteDirectory($dir . DIRECTORY_SEPARATOR . $item)) return false;
}
return rmdir($dir);
}
if (deleteDirectory(__DIR__)) {
echo json_encode(['success' => true, 'message' => 'Install დირექტორია წარმატებით წაიშალა']);
} else {
echo json_encode(['success' => false, 'message' => 'შეცდომა დირექტორიის წაშლისას']);
}
?>
+65
View File
@@ -0,0 +1,65 @@
<?php
if (!file_exists(__DIR__ . '/install.lock')) {
header("Location: index.php");
exit;
}
?>
<!DOCTYPE html>
<html>
<head>
<title>ინსტალაცია დასრულებული</title>
<meta charset="utf-8">
<style>
body {
font-family: Arial, sans-serif;
max-width: 600px;
margin: 50px auto;
padding: 20px;
text-align: center;
}
h2 { color: #28a745; }
.success-icon { font-size: 48px; color: #28a745; margin-bottom: 20px; }
.warning {
background: #fff3cd;
border: 1px solid #ffeaa7;
padding: 15px;
border-radius: 4px;
margin: 20px 0;
color: #856404;
}
.btn {
background: #007cba;
color: white;
padding: 12px 24px;
text-decoration: none;
border-radius: 4px;
display: inline-block;
margin: 10px;
}
.btn:hover { background: #005a87; }
.btn-danger { background: #dc3545; }
.btn-danger:hover { background: #c82333; }
</style>
</head>
<body>
<div class="success-icon">✅</div>
<h2>ინსტალაცია წარმატებით დასრულდა!</h2>
<p>თქვენი სისტემა მზად არის გამოსაყენებლად.</p>
<div class="warning">
<strong>უსაფრთხოების მიზნებისთვის:</strong><br>
გთხოვთ წაშალოთ <code>/install</code> დირექტორია სისტემიდან.<br>
<code>rm -rf <?= __DIR__ ?></code>
</div>
<div>
<a href="../login.php" class="btn">ავტორიზაცია</a>
<a href="../dashboard.php" class="btn">ადმინ პანელი</a>
</div>
<div style="margin-top: 30px;">
<a href="#" onclick="if(confirm('დარწმუნებული ხართ?')) { fetch('cleanup.php'); alert('install ფოლდერი წაშლილია'); }" class="btn btn-danger">Install ფოლდერის წაშლა</a>
</div>
</body>
</html>
+6
View File
@@ -0,0 +1,6 @@
<?php
if (file_exists(__DIR__ . '/install.lock')) {
die("პროექტი უკვე დაყენებულია.");
}
header("Location: step1_check.php");
exit;
+1
View File
@@ -0,0 +1 @@
installed on 2025-07-31 10:24:18
+94
View File
@@ -0,0 +1,94 @@
<?php
$errors = [];
$warnings = [];
// PHP version check
if (version_compare(PHP_VERSION, '7.4.0', '<')) {
$errors[] = "საჭიროა PHP 7.4 ან უფრო ახალი ვერსია. მიმდინარე ვერსია: " . PHP_VERSION;
}
// Required extensions
$requiredExtensions = ['mysqli', 'json', 'mbstring'];
foreach ($requiredExtensions as $ext) {
if (!extension_loaded($ext)) {
$errors[] = "საჭიროა $ext გაფართოება.";
}
}
// Optional extensions
$optionalExtensions = ['curl', 'openssl', 'zip'];
foreach ($optionalExtensions as $ext) {
if (!extension_loaded($ext)) {
$warnings[] = "რეკომენდებულია $ext გაფართოება.";
}
}
// Directory permissions
$directories = [
__DIR__ . '/../uploads' => 'uploads',
__DIR__ . '/../cache' => 'cache',
__DIR__ . '/../logs' => 'logs'
];
foreach ($directories as $dir => $name) {
if (!is_dir($dir)) {
@mkdir($dir, 0755, true);
}
if (!is_writable($dir)) {
$errors[] = "საქაღალდე '$name' უნდა იყოს ჩაწერადი.";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>ინსტალაცია ნაბიჯი 1</title>
<meta charset="utf-8">
<style>
body { font-family: Arial, sans-serif; max-width: 600px; margin: 50px auto; padding: 20px; }
h2 { color: #333; }
.success { color: green; font-weight: bold; }
.error { color: red; }
.warning { color: orange; }
ul { padding-left: 20px; }
.continue-btn { background: #28a745; color: white; padding: 10px 20px; text-decoration: none; border-radius: 4px; display: inline-block; margin-top: 15px; }
.continue-btn:hover { background: #218838; }
.status-ok { color: green; }
.status-error { color: red; }
.status-warning { color: orange; }
</style>
</head>
<body>
<h2>სისტემური მოთხოვნები</h2>
<h3>აუცილებელი მოთხოვნები:</h3>
<ul>
<li>PHP ვერსია: <span class="<?= version_compare(PHP_VERSION, '7.4.0', '>=') ? 'status-ok' : 'status-error' ?>"><?= PHP_VERSION ?></span></li>
<?php foreach ($requiredExtensions as $ext): ?>
<li><?= $ext ?> გაფართოება: <span class="<?= extension_loaded($ext) ? 'status-ok' : 'status-error' ?>"><?= extension_loaded($ext) ? 'დაყენებული' : 'არ არის დაყენებული' ?></span></li>
<?php endforeach; ?>
</ul>
<?php if ($warnings): ?>
<h3>რეკომენდაციები:</h3>
<ul>
<?php foreach ($warnings as $warning): ?>
<li class="warning"><?= htmlspecialchars($warning) ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if ($errors): ?>
<h3>შეცდომები:</h3>
<ul>
<?php foreach ($errors as $error): ?>
<li class="error"><?= htmlspecialchars($error) ?></li>
<?php endforeach; ?>
</ul>
<p class="error">გთხოვთ გამოასწოროთ ყველა შეცდომა და განაახლოთ გვერდი.</p>
<?php else: ?>
<p class="success">✓ ყველაფერი მზად არის ინსტალაციისთვის!</p>
<a href="step2_dbconfig.php" class="continue-btn">გაგრძელება</a>
<?php endif; ?>
</body>
</html>
+80
View File
@@ -0,0 +1,80 @@
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$host = $_POST['host'];
$user = $_POST['user'];
$pass = $_POST['pass'];
$db = $_POST['dbname'];
$conn = @new mysqli($host, $user, $pass, $db);
if ($conn->connect_error) {
$error = "ბაზასთან კავშირის შეცდომა: " . $conn->connect_error;
} else {
// config.php გენერაცია
$config = "<?php\nreturn [\n" .
" // Database configuration (compatible with install wizard)\n" .
" 'host' => '$host',\n" .
" 'user' => '$user',\n" .
" 'pass' => '$pass',\n" .
" 'dbname' => '$db',\n" .
" 'port' => 3306,\n" .
" 'charset' => 'utf8mb4',\n\n" .
" // Additional database configuration (nested for better organization)\n" .
" 'db' => [\n" .
" 'host' => '$host',\n" .
" 'user' => '$user',\n" .
" 'pass' => '$pass',\n" .
" 'name' => '$db',\n" .
" 'port' => 3306,\n" .
" 'charset' => 'utf8mb4'\n" .
" ],\n\n" .
" // ზოგადი პროექტის პარამეტრები\n" .
" 'app' => [\n" .
" 'base_url' => 'http://localhost/',\n" .
" 'debug' => true,\n" .
" 'installed' => true,\n" .
" 'version' => '1.0.0'\n" .
" ]\n];";
file_put_contents(__DIR__ . '/../config.php', $config);
header("Location: step3_import.php");
exit;
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>ინსტალაცია ნაბიჯი 2</title>
<meta charset="utf-8">
<style>
body { font-family: Arial, sans-serif; max-width: 600px; margin: 50px auto; padding: 20px; }
h2 { color: #333; }
label { display: block; margin-top: 10px; font-weight: bold; }
input { width: 100%; padding: 8px; margin-top: 5px; border: 1px solid #ddd; border-radius: 4px; }
button { background: #007cba; color: white; padding: 10px 20px; border: none; border-radius: 4px; margin-top: 15px; cursor: pointer; }
button:hover { background: #005a87; }
.error { color: red; margin-top: 10px; }
</style>
</head>
<body>
<h2>მონაცემთა ბაზის კონფიგურაცია</h2>
<?php if (isset($error)): ?>
<p class="error"><?= htmlspecialchars($error) ?></p>
<?php endif; ?>
<form method="post">
<label for="host">ჰოსტი:</label>
<input type="text" name="host" id="host" value="localhost" required>
<label for="user">მომხმარებელი:</label>
<input type="text" name="user" id="user" value="root" required>
<label for="pass">პაროლი:</label>
<input type="password" name="pass" id="pass">
<label for="dbname">ბაზის სახელი:</label>
<input type="text" name="dbname" id="dbname" required>
<button type="submit">შენახვა და გაგრძელება</button>
</form>
</body>
</html>
+86
View File
@@ -0,0 +1,86 @@
<?php
$config = include __DIR__ . '/../config.php';
$conn = new mysqli($config['host'], $config['user'], $config['pass'], $config['dbname']);
if ($conn->connect_error) {
die("ბაზასთან კავშირის შეცდომა: " . $conn->connect_error);
}
$sqlFile = __DIR__ . '/structure.sql';
if (!file_exists($sqlFile)) {
die("SQL ფაილი ვერ მოიძებნა: structure.sql");
}
$sql = file_get_contents($sqlFile);
$success = true;
$errorMessage = '';
// Execute multi-query
if ($conn->multi_query($sql)) {
do {
// Process results
if ($result = $conn->store_result()) {
$result->free();
}
} while ($conn->more_results() && $conn->next_result());
// Check for errors
if ($conn->error) {
$success = false;
$errorMessage = $conn->error;
}
} else {
$success = false;
$errorMessage = $conn->error;
}
if ($success) {
// Auto-redirect after 2 seconds
header("refresh:2;url=step4_admin.php");
}
?>
<!DOCTYPE html>
<html>
<head>
<title>ინსტალაცია ნაბიჯი 3</title>
<meta charset="utf-8">
<style>
body { font-family: Arial, sans-serif; max-width: 600px; margin: 50px auto; padding: 20px; text-align: center; }
h2 { color: #333; }
.success { color: #28a745; }
.error { color: #dc3545; background: #f8d7da; padding: 15px; border: 1px solid #f5c6cb; border-radius: 4px; }
.loading { font-size: 18px; margin: 20px 0; }
.spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid #f3f3f3; border-top: 3px solid #007cba; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.btn { background: #007cba; color: white; padding: 10px 20px; text-decoration: none; border-radius: 4px; display: inline-block; margin-top: 15px; }
.btn:hover { background: #005a87; }
</style>
</head>
<body>
<h2>მონაცემთა ბაზის იმპორტი</h2>
<?php if ($success): ?>
<div class="success">
<h3>✅ ბაზა წარმატებით შეიქმნა!</h3>
<div class="loading">
<div class="spinner"></div>
მიმდინარეობს გადამისამართება...
</div>
<p>თუ ავტომატური გადამისამართება არ მუშაობს:</p>
<a href="step4_admin.php" class="btn">გაგრძელება</a>
</div>
<?php else: ?>
<div class="error">
<h3>❌ ბაზის იმპორტის შეცდომა</h3>
<p><?= htmlspecialchars($errorMessage) ?></p>
<p>გთხოვთ შეამოწმოთ:</p>
<ul style="text-align: left;">
<li>ბაზის ნებართვები</li>
<li>structure.sql ფაილის არსებობა</li>
<li>SQL სინტაქსის სისწორე</li>
</ul>
<a href="step2_dbconfig.php" class="btn">უკან დაბრუნება</a>
</div>
<?php endif; ?>
</body>
</html>
+153
View File
@@ -0,0 +1,153 @@
<?php
// Enable error reporting for debugging
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
try {
$config = include __DIR__ . '/../config.php';
if (!$config) {
throw new Exception("კონფიგურაციის ფაილი ვერ ჩაიტვირთა");
}
$conn = new mysqli($config['host'], $config['user'], $config['pass'], $config['dbname']);
if ($conn->connect_error) {
throw new Exception("ბაზასთან კავშირის შეცდომა: " . $conn->connect_error);
}
$conn->set_charset("utf8mb4");
} catch (Exception $e) {
$error = $e->getMessage();
$conn = null;
}
if (isset($conn) && $conn) {
$first_name = trim($_POST['first_name']);
$last_name = trim($_POST['last_name']);
$password = $_POST['password'];
$email = trim($_POST['email']);
// Validation
if (strlen($first_name) < 2) {
$error = "სახელი უნდა იყოს მინიმუმ 2 სიმბოლო";
} elseif (strlen($last_name) < 2) {
$error = "გვარი უნდა იყოს მინიმუმ 2 სიმბოლო";
} elseif (strlen($password) < 6) {
$error = "პაროლი უნდა იყოს მინიმუმ 6 სიმბოლო";
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error = "გთხოვთ შეიყვანოთ სწორი ელ-ფოსტა";
} else {
$hashedPassword = password_hash($password, PASSWORD_DEFAULT);
// არსებული users ცხრილის სტრუქტურა: first_name, last_name, email, password, created_at
$stmt = $conn->prepare("INSERT INTO users (first_name, last_name, email, password, created_at) VALUES (?, ?, ?, ?, NOW())");
if (!$stmt) {
throw new Exception("Statement preparation failed: " . $conn->error);
}
$stmt->bind_param("ssss", $first_name, $last_name, $email, $hashedPassword);
if ($stmt->execute()) {
// განაახლოს config.php ფაილი installed სტატუსით
$currentConfig = include __DIR__ . '/../config.php';
$currentConfig['app']['installed'] = true;
$configContent = "<?php\nreturn " . var_export($currentConfig, true) . ";\n";
file_put_contents(__DIR__ . '/../config.php', $configContent);
file_put_contents(__DIR__ . '/install.lock', "installed on " . date('Y-m-d H:i:s'));
header("Location: finish.php");
exit;
} else {
throw new Exception("მომხმარებლის შექმნის შეცდომა: " . $stmt->error);
}
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>ინსტალაცია ნაბიჯი 4</title>
<meta charset="utf-8">
<style>
body { font-family: Arial, sans-serif; max-width: 600px; margin: 50px auto; padding: 20px; }
h2 { color: #333; }
label { display: block; margin-top: 10px; font-weight: bold; }
input { width: 100%; padding: 8px; margin-top: 5px; border: 1px solid #ddd; border-radius: 4px; }
button { background: #28a745; color: white; padding: 10px 20px; border: none; border-radius: 4px; margin-top: 15px; cursor: pointer; }
button:hover { background: #218838; }
.error { color: red; margin-top: 10px; padding: 10px; background: #ffeaea; border: 1px solid #ffcccc; border-radius: 4px; }
.info { background: #e7f3ff; border: 1px solid #b3d9ff; padding: 15px; border-radius: 4px; margin-bottom: 20px; }
</style>
</head>
<body>
<h2>ადმინისტრატორის ანგარიშის შექმნა</h2>
<div class="info">
<strong>ბოლო ნაბიჯი!</strong><br>
შექმენით ადმინისტრატორის ანგარიში სისტემაში შესასვლელად.
</div>
<?php if (isset($error)): ?>
<div class="error"><?= htmlspecialchars($error) ?></div>
<?php endif; ?>
<?php if (isset($_GET['debug'])): ?>
<div style="background: #f0f0f0; padding: 10px; border: 1px solid #ccc; margin: 10px 0;">
<strong>Debug Info:</strong><br>
Config file path: <?= __DIR__ . '/../config.php' ?><br>
Config exists: <?= file_exists(__DIR__ . '/../config.php') ? 'Yes' : 'No' ?><br>
<?php if (file_exists(__DIR__ . '/../config.php')): ?>
<?php $testConfig = include __DIR__ . '/../config.php'; ?>
Host: <?= isset($testConfig['host']) ? $testConfig['host'] : 'NOT SET' ?><br>
User: <?= isset($testConfig['user']) ? $testConfig['user'] : 'NOT SET' ?><br>
DBName: <?= isset($testConfig['dbname']) ? $testConfig['dbname'] : 'NOT SET' ?><br>
<?php endif; ?>
</div>
<?php endif; ?>
<form method="post">
<label for="first_name">სახელი:</label>
<input type="text" name="first_name" id="first_name" value="<?= isset($_POST['first_name']) ? htmlspecialchars($_POST['first_name']) : '' ?>" required minlength="2">
<label for="last_name">გვარი:</label>
<input type="text" name="last_name" id="last_name" value="<?= isset($_POST['last_name']) ? htmlspecialchars($_POST['last_name']) : '' ?>" required minlength="2">
<label for="email">ელ-ფოსტა:</label>
<input type="email" name="email" id="email" value="<?= isset($_POST['email']) ? htmlspecialchars($_POST['email']) : '' ?>" required>
<label for="password">პაროლი:</label>
<input type="password" name="password" id="password" required minlength="6">
<button type="submit">ანგარიშის შექმნა და ინსტალაციის დასრულება</button>
</form>
<script>
document.querySelector('form').addEventListener('submit', function(e) {
const password = document.getElementById('password').value;
const firstName = document.getElementById('first_name').value;
const lastName = document.getElementById('last_name').value;
if (firstName.length < 2) {
alert('სახელი უნდა იყოს მინიმუმ 2 სიმბოლო');
e.preventDefault();
return;
}
if (lastName.length < 2) {
alert('გვარი უნდა იყოს მინიმუმ 2 სიმბოლო');
e.preventDefault();
return;
}
if (password.length < 6) {
alert('პაროლი უნდა იყოს მინიმუმ 6 სიმბოლო');
e.preventDefault();
}
});
</script>
</body>
</html>
+176
View File
@@ -0,0 +1,176 @@
-- --------------------------------------------------------
-- Host: 192.168.10.121
-- Server version: 10.11.11-MariaDB-0+deb12u1 - Debian 12
-- Server OS: debian-linux-gnu
-- HeidiSQL Version: 12.10.0.7000
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-- Dumping structure for table bl_db.clients
CREATE TABLE IF NOT EXISTS `clients` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`first_name` varchar(100) NOT NULL,
`last_name` varchar(100) NOT NULL,
`company_name` varchar(150) DEFAULT NULL,
`vat_number` varchar(150) DEFAULT NULL,
`email` varchar(150) NOT NULL,
`password` varchar(255) NOT NULL,
`address1` varchar(255) DEFAULT NULL,
`address2` varchar(255) DEFAULT NULL,
`city` varchar(100) DEFAULT NULL,
`state` varchar(100) DEFAULT NULL,
`postcode` varchar(20) DEFAULT NULL,
`country` varchar(2) DEFAULT NULL,
`phone` varchar(50) DEFAULT NULL,
`payment_method` varchar(50) DEFAULT NULL,
`billing_contact` varchar(100) DEFAULT NULL,
`currency` varchar(10) DEFAULT 'USD',
`language` varchar(10) DEFAULT 'default',
`status` enum('active','inactive') DEFAULT 'active',
`client_group` varchar(50) DEFAULT 'none',
`created_at` timestamp NULL DEFAULT current_timestamp(),
`admin_notes` text DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- Data exporting was unselected.
-- Dumping structure for table bl_db.email_logs
CREATE TABLE IF NOT EXISTS `email_logs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`client_id` int(11) NOT NULL,
`subject` varchar(255) DEFAULT NULL,
`message` text DEFAULT NULL,
`sent_at` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
KEY `client_id` (`client_id`),
CONSTRAINT `email_logs_ibfk_1` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- Data exporting was unselected.
-- Dumping structure for table bl_db.email_templates
CREATE TABLE IF NOT EXISTS `email_templates` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`subject` varchar(255) NOT NULL,
`body` text NOT NULL,
`created_at` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- Data exporting was unselected.
-- Dumping structure for table bl_db.invoices
CREATE TABLE IF NOT EXISTS `invoices` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`invoice_number` varchar(100) DEFAULT NULL,
`client_id` int(11) NOT NULL,
`description` text DEFAULT NULL,
`payment_method` varchar(100) DEFAULT NULL,
`status` enum('დრაფტი','გადაუხდელი','გადასახდელი','გადახდილი','გაუქმებული') NOT NULL DEFAULT 'დრაფტი',
`total_amount` decimal(10,2) NOT NULL DEFAULT 0.00,
`is_recurring` tinyint(1) DEFAULT 0,
`issue_date` date NOT NULL,
`due_date` date NOT NULL,
`payment_date` date DEFAULT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp(),
`recurring` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `invoice_number` (`invoice_number`),
KEY `client_id` (`client_id`),
CONSTRAINT `invoices_ibfk_1` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- Data exporting was unselected.
-- Dumping structure for table bl_db.invoice_items
CREATE TABLE IF NOT EXISTS `invoice_items` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`invoice_id` int(11) NOT NULL,
`product_id` int(11) DEFAULT NULL,
`description` text DEFAULT NULL,
`amount` decimal(10,2) NOT NULL DEFAULT 0.00,
PRIMARY KEY (`id`),
KEY `invoice_id` (`invoice_id`),
CONSTRAINT `invoice_items_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- Data exporting was unselected.
-- Dumping structure for table bl_db.migration_log
CREATE TABLE IF NOT EXISTS `migration_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`filename` varchar(255) DEFAULT NULL,
`executed_at` datetime DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- Data exporting was unselected.
-- Dumping structure for table bl_db.products
CREATE TABLE IF NOT EXISTS `products` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`group` varchar(255) NOT NULL,
`type` varchar(100) DEFAULT NULL,
`pay_type` varchar(100) DEFAULT NULL,
`auto_setup` varchar(100) DEFAULT NULL,
`url` text DEFAULT NULL,
`module` varchar(100) DEFAULT NULL,
`hidden` tinyint(1) DEFAULT 0,
`created_at` datetime DEFAULT current_timestamp(),
`updated_at` datetime DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`price` decimal(10,2) NOT NULL DEFAULT 0.00,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- Data exporting was unselected.
-- Dumping structure for table bl_db.transactions
CREATE TABLE IF NOT EXISTS `transactions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`invoice_id` int(11) NOT NULL,
`client_id` int(11) NOT NULL,
`amount` decimal(10,2) NOT NULL,
`method` varchar(100) DEFAULT NULL,
`status` enum('success','failed','pending') NOT NULL DEFAULT 'pending',
`notes` text DEFAULT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
KEY `invoice_id` (`invoice_id`),
KEY `client_id` (`client_id`),
CONSTRAINT `transactions_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `invoices` (`id`) ON DELETE CASCADE,
CONSTRAINT `transactions_ibfk_2` FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- Data exporting was unselected.
-- Dumping structure for table bl_db.users
CREATE TABLE IF NOT EXISTS `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`first_name` varchar(100) NOT NULL,
`last_name` varchar(100) NOT NULL,
`email` varchar(150) NOT NULL,
`password` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- Data exporting was unselected.
/*!40103 SET TIME_ZONE=IFNULL(@OLD_TIME_ZONE, 'system') */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;