-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase-setup.sql
More file actions
38 lines (30 loc) · 1.89 KB
/
Copy pathdatabase-setup.sql
File metadata and controls
38 lines (30 loc) · 1.89 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
-- OrderNet Database Setup Script
-- Run this script to set up the initial database structure
-- Create database (if not exists)
CREATE DATABASE IF NOT EXISTS ordernet_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- Use the database
USE ordernet_db;
-- The tables will be automatically created by Hibernate/JPA when the application starts
-- This script is for reference and manual setup if needed
-- Optional: Create a dedicated user for the application
-- CREATE USER 'ordernet_user'@'localhost' IDENTIFIED BY 'secure_password';
-- GRANT ALL PRIVILEGES ON ordernet_db.* TO 'ordernet_user'@'localhost';
-- FLUSH PRIVILEGES;
-- Sample data insertion (optional - for testing)
-- Note: These will be created automatically by the application
-- Sample Categories
INSERT INTO categories (name, description, is_active, created_at, updated_at) VALUES
('Electronics', 'Electronic devices and accessories', true, NOW(), NOW()),
('Clothing', 'Fashion and apparel', true, NOW(), NOW()),
('Books', 'Books and educational materials', true, NOW(), NOW()),
('Home & Garden', 'Home improvement and garden supplies', true, NOW(), NOW()),
('Sports & Outdoors', 'Sports equipment and outdoor gear', true, NOW(), NOW());
-- Sample Admin User (password: admin123 - should be hashed in production)
-- Note: Password should be hashed using BCrypt before inserting
INSERT INTO users (first_name, last_name, email, password, phone, role, is_active, created_at, updated_at) VALUES
('Admin', 'User', 'admin@ordernet.com', '$2a$10$N.zmdr9k7uOCQb376NoUnuTJ8iKyVhNWm4e7GjR2n6N7lQJqQqQqQ', '+1234567890', 'ADMIN', true, NOW(), NOW());
-- Note:
-- 1. The password above is a placeholder - use proper BCrypt hashing in production
-- 2. Replace 'admin123' with a secure password and hash it properly
-- 3. Update the email and phone number as needed
-- 4. The application will create these tables automatically with proper constraints and relationships