-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbat.setup_db.bat
82 lines (65 loc) · 1.44 KB
/
bat.setup_db.bat
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
80
81
82
@echo off
echo.
set hour=%time:~0,2%
if "%hour:~0,1%" == " " set hour=0%hour:~1,1%
set bin_doctrine=%~dp0\vendor\doctrine\doctrine-module\bin\doctrine-module
set file="%date:~6,4%%date:~3,2%%date:~0,2%%hour%%time:~3,2%%time:~6,2%.sql"
set host=localhost
set db=cervin
set user=root
:MENU
echo -- Default values --
echo Host : %host%
echo DB : %db%
echo User: %user%
rem echo File: %file%
echo.
set /p msg=Use default values : (y/n)?
if "%msg%"=="y" goto IMPORT
if "%msg%"=="n" goto CONFIG
goto MENU
:CONFIG
set /p host=Host :
echo.
set /p db=DB :
echo.
set /p user=User :
echo.
goto IMPORT
:IMPORT
rem echo.
rem echo Deleting database: %db%
rem echo.
rem echo DROP DATABASE IF EXISTS %db% > %file%
rem mysql -h %host% -u %user% < %file%
echo.
echo - Create database %db% if not exists -
echo.
echo CREATE DATABASE IF NOT EXISTS %db% > %file%
mysql -h %host% -u %user% < %file%
del /F /Q %file%
echo.
echo - Delete database schema -
echo.
php "%bin_doctrine%" orm:schema-tool:drop --force
rem echo.
rem echo SQL dump to import:
rem echo.
rem php "%bin_doctrine%" orm:schema-tool:create --dump-sql
echo.
echo - Import database schema -
echo.
php "%bin_doctrine%" orm:schema-tool:update --force
echo.
echo - Import fixtures -
echo.
php "%bin_doctrine%" data-fixture:import > fixtures.log
echo.
echo - Deleting fixtures logs -
echo.
php "%bin_doctrine%" dbal:run-sql "TRUNCATE `ext_log_entries`"
goto EXIT
:EXIT
echo.
echo Press any key to quit
pause > nul