-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsql.sql
More file actions
47 lines (41 loc) · 1.29 KB
/
sql.sql
File metadata and controls
47 lines (41 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
-- Mevcut veritabanını silme
DROP DATABASE IF EXISTS modloff;
-- Yeni veritabanı oluşturma
CREATE DATABASE modloff;
-- Kullanılacak veritabanı belirtme
USE modloff;
-- Customers Tablosu
CREATE TABLE customers (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Invoices Tablosu
CREATE TABLE invoices (
id INT AUTO_INCREMENT PRIMARY KEY,
customer_id INT,
amount DECIMAL(10, 2) NOT NULL,
status ENUM('unpaid', 'paid') DEFAULT 'unpaid',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (customer_id) REFERENCES customers(id)
);
-- Products Tablosu
CREATE TABLE products (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
description TEXT,
price DECIMAL(10, 2) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Tickets Tablosu
CREATE TABLE tickets (
id INT AUTO_INCREMENT PRIMARY KEY,
customer_id INT,
subject VARCHAR(255) NOT NULL,
message TEXT NOT NULL,
status ENUM('open', 'closed') DEFAULT 'open',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (customer_id) REFERENCES customers(id)
);