-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-mysql-tables.bat
More file actions
80 lines (72 loc) · 2.05 KB
/
Copy pathsetup-mysql-tables.bat
File metadata and controls
80 lines (72 loc) · 2.05 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
@echo off
echo ========================================
echo OrderNet MySQL Database Setup
echo ========================================
echo.
REM Check if MySQL is installed
where mysql >nul 2>nul
if %errorlevel% neq 0 (
echo MySQL command line client not found in PATH.
echo Please install MySQL or add it to your PATH.
echo.
echo You can:
echo 1. Install MySQL Server from: https://dev.mysql.com/downloads/mysql/
echo 2. Or use Docker: docker run --name mysql -e MYSQL_ROOT_PASSWORD=password -p 3306:3306 -d mysql:8.0
echo.
pause
exit /b 1
)
echo MySQL found. Starting database setup...
echo.
REM Prompt for MySQL root password
set /p mysql_password="Enter MySQL root password (default: password): "
if "%mysql_password%"=="" set mysql_password=password
echo.
echo Creating OrderNet database and tables...
echo.
REM Run the SQL script
mysql -u root -p%mysql_password% < mysql-tables.sql
if %errorlevel% equ 0 (
echo.
echo ========================================
echo SUCCESS! OrderNet database setup complete.
echo ========================================
echo.
echo Database: ordernet_db
echo Tables created:
echo - users
echo - categories
echo - products
echo - images
echo - addresses
echo - carts
echo - cart_items
echo - orders
echo - order_items
echo - reviews
echo - refresh_tokens
echo - password_reset_tokens
echo - files
echo.
echo Sample data inserted:
echo - 5 categories
echo - 1 admin user (admin@ordernet.com / admin123)
echo - 1 customer user (customer@ordernet.com / customer123)
echo - 5 sample products
echo - 1 sample address
echo.
echo You can now start your Spring Boot application!
) else (
echo.
echo ========================================
echo ERROR! Database setup failed.
echo ========================================
echo.
echo Please check:
echo 1. MySQL is running
echo 2. Root password is correct
echo 3. You have permission to create databases
echo.
)
echo.
pause