-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.sql
More file actions
53 lines (48 loc) · 1.92 KB
/
Copy pathdatabase.sql
File metadata and controls
53 lines (48 loc) · 1.92 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
48
49
50
51
52
53
-- database.sql
-- Run this in your PhpMyAdmin or MySQL console to set up the database
CREATE DATABASE IF NOT EXISTS internship_system;
USE internship_system;
-- Table: users
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
email VARCHAR(100) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
role ENUM('Admin', 'Student') DEFAULT 'Student',
phone VARCHAR(20) DEFAULT NULL,
college VARCHAR(150) DEFAULT NULL,
degree VARCHAR(100) DEFAULT NULL,
cgpa DECIMAL(4,2) DEFAULT NULL,
enrollment_no VARCHAR(50) DEFAULT NULL,
linkedin VARCHAR(100) DEFAULT NULL,
github VARCHAR(100) DEFAULT NULL,
leetcode VARCHAR(100) DEFAULT NULL,
codeforces VARCHAR(100) DEFAULT NULL,
codechef VARCHAR(100) DEFAULT NULL,
geeksforgeeks VARCHAR(100) DEFAULT NULL,
hackerrank VARCHAR(100) DEFAULT NULL,
resume_path VARCHAR(255) DEFAULT NULL
);
-- Table: internships
CREATE TABLE IF NOT EXISTS internships (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(150) NOT NULL,
company VARCHAR(150) NOT NULL,
location VARCHAR(150) NOT NULL,
description TEXT NOT NULL,
posted_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Table: applications
CREATE TABLE IF NOT EXISTS applications (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
intern_id INT NOT NULL,
status ENUM('Pending', 'Approved', 'Rejected') DEFAULT 'Pending',
applied_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (intern_id) REFERENCES internships(id) ON DELETE CASCADE
);
-- Insert a default admin for testing (Password is 'admin123')
-- The hash below is generated by password_hash('admin123', PASSWORD_DEFAULT)
INSERT INTO users (name, email, password, role) VALUES
('System Admin', 'admin@example.com', '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', 'Admin');