-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgenerate_install_scripts.bat
More file actions
708 lines (665 loc) · 27.1 KB
/
generate_install_scripts.bat
File metadata and controls
708 lines (665 loc) · 27.1 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
@echo off
setlocal enabledelayedexpansion
:: Base directory for modules
set BASE_DIR=%~dp0source\database\modules
:: Create a temporary directory for sorted files
set TEMP_DIR=%TEMP%\sorted_files
if exist "%TEMP_DIR%" rmdir /s /q "%TEMP_DIR%"
mkdir "%TEMP_DIR%"
:: Loop through each module directory
for /d %%d in ("%BASE_DIR%\*") do (
echo Processing module: %%~nxd
:: Generate module install.sql
echo Generating install script for %%~nxd...
(
echo /*
echo --------------------------------- MIT License ---------------------------------
echo Copyright ^(c^) 2019 - 2026 jtsoya539, DamyGenius and RISK contributors
echo.
echo Permission is hereby granted, free of charge, to any person obtaining a copy
echo of this software and associated documentation files ^(the ^"Software^"^), to deal
echo in the Software without restriction, including without limitation the rights
echo to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
echo copies of the Software, and to permit persons to whom the Software is
echo furnished to do so, subject to the following conditions:
echo.
echo The above copyright notice and this permission notice shall be included in all
echo copies or substantial portions of the Software.
echo.
echo THE SOFTWARE IS PROVIDED ^"AS IS^", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
echo IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
echo FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
echo AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
echo LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
echo OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
echo SOFTWARE.
echo -------------------------------------------------------------------------------
echo */
echo.
echo spool install.log
echo.
echo set feedback off
echo set define off
echo.
echo prompt ###################################
echo prompt # _____ _____ _____ _ __ #
echo prompt # ^| __ \ ^|_ _^| / ____^|^| ^|/ / #
echo prompt # ^| ^|__^) ^| ^| ^| ^| ^(___ ^| ' / #
echo prompt # ^| _ / ^| ^| \___ \ ^| ^< #
echo prompt # ^| ^| \ \ _^| ^|_ ____^) ^|^| . \ #
echo prompt # ^|_^| \_\^|_____^|^|_____/ ^|_^|\_\ #
echo prompt # #
echo prompt # jtsoya539 #
echo prompt ###################################
echo.
echo prompt
echo prompt ===================================
echo prompt Installation started
echo prompt ===================================
echo prompt
echo @@../../define_variables.sql
echo @@../../set_compiler_flags.sql %%~nxd
echo.
echo prompt
echo prompt Creating sequences...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of sequence files
if exist "%%d\sequences\*.seq" (
dir /b "%%d\sequences\*.seq" > "%TEMP_DIR%\sequences.txt"
sort "%TEMP_DIR%\sequences.txt" /o "%TEMP_DIR%\sequences_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\sequences_sorted.txt) do (
echo @@sequences/%%f
)
)
echo.
echo prompt
echo prompt Creating tables...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of table files
if exist "%%d\tables\*.tab" (
dir /b "%%d\tables\*.tab" > "%TEMP_DIR%\tables.txt"
sort "%TEMP_DIR%\tables.txt" /o "%TEMP_DIR%\tables_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\tables_sorted.txt) do (
echo @@tables/%%f
)
)
echo.
echo prompt
echo prompt Creating foreign keys...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of foreign key files
if exist "%%d\foreign_keys\*.sql" (
dir /b "%%d\foreign_keys\*.sql" > "%TEMP_DIR%\foreign_keys.txt"
sort "%TEMP_DIR%\foreign_keys.txt" /o "%TEMP_DIR%\foreign_keys_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\foreign_keys_sorted.txt) do (
echo @@foreign_keys/%%f
)
)
echo.
echo prompt
echo prompt Creating views...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of view files
if exist "%%d\views\*.vw" (
dir /b "%%d\views\*.vw" > "%TEMP_DIR%\views.txt"
sort "%TEMP_DIR%\views.txt" /o "%TEMP_DIR%\views_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\views_sorted.txt) do (
echo @@views/%%f
)
)
echo.
echo prompt
echo prompt Creating type specs...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of type spec files
if exist "%%d\type_specs\*.tps" (
dir /b "%%d\type_specs\*.tps" > "%TEMP_DIR%\type_specs.txt"
sort "%TEMP_DIR%\type_specs.txt" /o "%TEMP_DIR%\type_specs_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\type_specs_sorted.txt) do (
echo @@type_specs/%%f
)
)
echo.
echo prompt
echo prompt Creating type bodies...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of type body files
if exist "%%d\type_bodies\*.tpb" (
dir /b "%%d\type_bodies\*.tpb" > "%TEMP_DIR%\type_bodies.txt"
sort "%TEMP_DIR%\type_bodies.txt" /o "%TEMP_DIR%\type_bodies_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\type_bodies_sorted.txt) do (
echo @@type_bodies/%%f
)
)
echo.
echo prompt
echo prompt Creating java sources...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of java source files
if exist "%%d\java\*.jsp" (
dir /b "%%d\java\*.jsp" > "%TEMP_DIR%\java.txt"
sort "%TEMP_DIR%\java.txt" /o "%TEMP_DIR%\java_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\java_sorted.txt) do (
echo @@java/%%f
)
)
echo.
echo prompt
echo prompt Creating functions...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of function files
if exist "%%d\functions\*.fnc" (
dir /b "%%d\functions\*.fnc" > "%TEMP_DIR%\functions.txt"
sort "%TEMP_DIR%\functions.txt" /o "%TEMP_DIR%\functions_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\functions_sorted.txt) do (
echo @@functions/%%f
)
)
echo.
echo prompt
echo prompt Creating procedures...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of procedure files
if exist "%%d\procedures\*.prc" (
dir /b "%%d\procedures\*.prc" > "%TEMP_DIR%\procedures.txt"
sort "%TEMP_DIR%\procedures.txt" /o "%TEMP_DIR%\procedures_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\procedures_sorted.txt) do (
echo @@procedures/%%f
)
)
echo.
echo prompt
echo prompt Creating package specs...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of package spec files
if exist "%%d\package_specs\*.spc" (
dir /b "%%d\package_specs\*.spc" > "%TEMP_DIR%\package_specs.txt"
sort "%TEMP_DIR%\package_specs.txt" /o "%TEMP_DIR%\package_specs_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\package_specs_sorted.txt) do (
echo @@package_specs/%%f
)
)
echo.
echo prompt
echo prompt Creating package bodies...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of package body files
if exist "%%d\package_bodies\*.bdy" (
dir /b "%%d\package_bodies\*.bdy" > "%TEMP_DIR%\package_bodies.txt"
sort "%TEMP_DIR%\package_bodies.txt" /o "%TEMP_DIR%\package_bodies_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\package_bodies_sorted.txt) do (
echo @@package_bodies/%%f
)
)
echo.
echo prompt
echo prompt Creating triggers...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of trigger files
if exist "%%d\triggers\*.trg" (
dir /b "%%d\triggers\*.trg" > "%TEMP_DIR%\triggers.txt"
sort "%TEMP_DIR%\triggers.txt" /o "%TEMP_DIR%\triggers_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\triggers_sorted.txt) do (
echo @@triggers/%%f
)
)
echo.
echo set define on
echo @@../../create_private_synonyms.sql ^&v_app_name
echo @@../../grant_objects.sql ^&v_app_name
echo set define off
echo @@../../compile_schema.sql
echo.
echo prompt
echo prompt Running scripts...
echo prompt -----------------------------------
echo prompt
if "%%~nxd"=="auditorias" (
echo begin p_configurar_modificacion^(pin_aplicacion =^> 'SQLPLUS'^); end;
echo /
)
echo @@scripts/module/install.sql
echo @@scripts/parameters/install.sql
echo @@scripts/meanings/install.sql
echo @@scripts/errors/install.sql
echo @@scripts/applications/install.sql
if "%%~nxd"=="risk" (
echo @@scripts/ins_t_autenticacion_origenes.sql
echo @@scripts/ins_t_roles.sql
)
:: Create sorted list of operation install script files
if exist "%%d\scripts\operations\install*.sql" (
dir /b "%%d\scripts\operations\install*.sql" > "%TEMP_DIR%\operations_install.txt"
sort "%TEMP_DIR%\operations_install.txt" /o "%TEMP_DIR%\operations_install_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\operations_install_sorted.txt) do (
echo @@scripts/operations/%%f
)
)
echo commit;
echo /
echo.
echo prompt
echo prompt Running additional scripts...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of additional install script files
if exist "%%d\install_scripts*.sql" (
dir /b "%%d\install_scripts*.sql" > "%TEMP_DIR%\install_scripts.txt"
sort "%TEMP_DIR%\install_scripts.txt" /o "%TEMP_DIR%\install_scripts_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\install_scripts_sorted.txt) do (
echo @@%%f
)
)
echo commit;
echo /
echo.
echo prompt
echo prompt ===================================
echo prompt Installation completed
echo prompt ===================================
echo prompt
echo.
echo spool off
) > "%%d\install.sql"
:: Generate module uninstall.sql
echo Generating uninstall script for %%~nxd...
(
echo /*
echo --------------------------------- MIT License ---------------------------------
echo Copyright ^(c^) 2019 - 2026 jtsoya539, DamyGenius and RISK contributors
echo.
echo Permission is hereby granted, free of charge, to any person obtaining a copy
echo of this software and associated documentation files ^(the ^"Software^"^), to deal
echo in the Software without restriction, including without limitation the rights
echo to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
echo copies of the Software, and to permit persons to whom the Software is
echo furnished to do so, subject to the following conditions:
echo.
echo The above copyright notice and this permission notice shall be included in all
echo copies or substantial portions of the Software.
echo.
echo THE SOFTWARE IS PROVIDED ^"AS IS^", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
echo IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
echo FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
echo AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
echo LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
echo OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
echo SOFTWARE.
echo -------------------------------------------------------------------------------
echo */
echo.
echo spool uninstall.log
echo.
echo set feedback off
echo set define off
echo.
echo prompt ###################################
echo prompt # _____ _____ _____ _ __ #
echo prompt # ^| __ \ ^|_ _^| / ____^|^| ^|/ / #
echo prompt # ^| ^|__^) ^| ^| ^| ^| ^(___ ^| ' / #
echo prompt # ^| _ / ^| ^| \___ \ ^| ^< #
echo prompt # ^| ^| \ \ _^| ^|_ ____^) ^|^| . \ #
echo prompt # ^|_^| \_\^|_____^|^|_____/ ^|_^|\_\ #
echo prompt # #
echo prompt # jtsoya539 #
echo prompt ###################################
echo.
echo prompt
echo prompt ===================================
echo prompt Uninstallation started
echo prompt ===================================
echo prompt
echo.
echo prompt
echo prompt Dropping triggers...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of trigger files for uninstall
if exist "%%d\triggers\*.trg" (
dir /b "%%d\triggers\*.trg" > "%TEMP_DIR%\triggers_uninstall.txt"
sort "%TEMP_DIR%\triggers_uninstall.txt" /o "%TEMP_DIR%\triggers_uninstall_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\triggers_uninstall_sorted.txt) do (
for /f "tokens=1* delims=." %%a in ("%%~nf") do echo drop trigger %%a;
)
)
echo.
echo prompt
echo prompt Dropping packages...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of package body files for uninstall
if exist "%%d\package_bodies\*.bdy" (
dir /b "%%d\package_bodies\*.bdy" > "%TEMP_DIR%\package_bodies_uninstall.txt"
sort "%TEMP_DIR%\package_bodies_uninstall.txt" /o "%TEMP_DIR%\package_bodies_uninstall_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\package_bodies_uninstall_sorted.txt) do (
for /f "tokens=1* delims=." %%a in ("%%~nf") do echo drop package %%a;
)
)
echo.
echo prompt
echo prompt Dropping procedures...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of procedure files for uninstall
if exist "%%d\procedures\*.prc" (
dir /b "%%d\procedures\*.prc" > "%TEMP_DIR%\procedures_uninstall.txt"
sort "%TEMP_DIR%\procedures_uninstall.txt" /o "%TEMP_DIR%\procedures_uninstall_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\procedures_uninstall_sorted.txt) do (
for /f "tokens=1* delims=." %%a in ("%%~nf") do echo drop procedure %%a;
)
)
echo.
echo prompt
echo prompt Dropping functions...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of function files for uninstall
if exist "%%d\functions\*.fnc" (
dir /b "%%d\functions\*.fnc" > "%TEMP_DIR%\functions_uninstall.txt"
sort "%TEMP_DIR%\functions_uninstall.txt" /o "%TEMP_DIR%\functions_uninstall_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\functions_uninstall_sorted.txt) do (
for /f "tokens=1* delims=." %%a in ("%%~nf") do echo drop function %%a;
)
)
echo.
echo prompt
echo prompt Dropping java sources...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of java source files for uninstall
if exist "%%d\java\*.jsp" (
dir /b "%%d\java\*.jsp" > "%TEMP_DIR%\java_uninstall.txt"
sort "%TEMP_DIR%\java_uninstall.txt" /o "%TEMP_DIR%\java_uninstall_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\java_uninstall_sorted.txt) do (
for /f "tokens=1* delims=." %%a in ("%%~nf") do echo drop java source %%a;
)
)
echo.
echo prompt
echo prompt Dropping types...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of type spec files for uninstall
if exist "%%d\type_specs\*.tps" (
dir /b "%%d\type_specs\*.tps" > "%TEMP_DIR%\type_specs_uninstall.txt"
sort "%TEMP_DIR%\type_specs_uninstall.txt" /o "%TEMP_DIR%\type_specs_uninstall_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\type_specs_uninstall_sorted.txt) do (
for /f "tokens=1* delims=." %%a in ("%%~nf") do echo drop type %%a force;
)
)
echo.
echo prompt
echo prompt Dropping views...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of view files for uninstall
if exist "%%d\views\*.vw" (
dir /b "%%d\views\*.vw" > "%TEMP_DIR%\views_uninstall.txt"
sort "%TEMP_DIR%\views_uninstall.txt" /o "%TEMP_DIR%\views_uninstall_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\views_uninstall_sorted.txt) do (
for /f "tokens=1* delims=." %%a in ("%%~nf") do echo drop view %%a cascade constraints;
)
)
echo.
echo prompt
echo prompt Dropping tables...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of table files for uninstall
if exist "%%d\tables\*.tab" (
dir /b "%%d\tables\*.tab" > "%TEMP_DIR%\tables_uninstall.txt"
sort "%TEMP_DIR%\tables_uninstall.txt" /o "%TEMP_DIR%\tables_uninstall_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\tables_uninstall_sorted.txt) do (
for /f "tokens=1* delims=." %%a in ("%%~nf") do echo drop table %%a cascade constraints purge;
)
)
echo.
echo prompt
echo prompt Dropping sequences...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of sequence files for uninstall
if exist "%%d\sequences\*.seq" (
dir /b "%%d\sequences\*.seq" > "%TEMP_DIR%\sequences_uninstall.txt"
sort "%TEMP_DIR%\sequences_uninstall.txt" /o "%TEMP_DIR%\sequences_uninstall_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\sequences_uninstall_sorted.txt) do (
for /f "tokens=1* delims=." %%a in ("%%~nf") do echo drop sequence %%a;
)
)
echo.
echo prompt
echo prompt Purging recycle bin...
echo prompt -----------------------------------
echo prompt
echo purge recyclebin;
echo.
echo --@@../../packages/k_modulo.pck
echo @@../../compile_schema.sql
echo.
echo prompt
echo prompt Running additional scripts...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of additional uninstall script files
if exist "%%d\uninstall_scripts*.sql" (
dir /b "%%d\uninstall_scripts*.sql" > "%TEMP_DIR%\uninstall_scripts.txt"
sort "%TEMP_DIR%\uninstall_scripts.txt" /o "%TEMP_DIR%\uninstall_scripts_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\uninstall_scripts_sorted.txt) do (
echo @@%%f
)
)
echo commit;
echo /
echo.
echo prompt
echo prompt Running scripts...
echo prompt -----------------------------------
echo prompt
:: Create sorted list of operation uninstall script files
if exist "%%d\scripts\operations\uninstall*.sql" (
dir /b "%%d\scripts\operations\uninstall*.sql" > "%TEMP_DIR%\operations_uninstall.txt"
sort "%TEMP_DIR%\operations_uninstall.txt" /o "%TEMP_DIR%\operations_uninstall_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\operations_uninstall_sorted.txt) do (
echo @@scripts/operations/%%f
)
)
if not "%%~nxd"=="risk" (
echo @@scripts/applications/uninstall.sql
echo @@scripts/errors/uninstall.sql
echo @@scripts/meanings/uninstall.sql
echo @@scripts/parameters/uninstall.sql
echo @@scripts/module/uninstall.sql
)
echo commit;
echo /
echo.
echo prompt
echo prompt ===================================
echo prompt Uninstallation completed
echo prompt ===================================
echo prompt
echo.
echo spool off
) > "%%d\uninstall.sql"
)
:: Generate tests install/uninstall scripts (only package specs / bodies)
set TEST_DIR=%~dp0test\database
if exist "%TEST_DIR%" (
echo Generating tests install script...
(
echo /*
echo --------------------------------- MIT License ---------------------------------
echo Copyright ^(c^) 2019 - 2026 jtsoya539, DamyGenius and RISK contributors
echo.
echo Permission is hereby granted, free of charge, to any person obtaining a copy
echo of this software and associated documentation files ^(the ^"Software^"^), to deal
echo in the Software without restriction, including without limitation the rights
echo to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
echo copies of the Software, and to permit persons to whom the Software is
echo furnished to do so, subject to the following conditions:
echo.
echo The above copyright notice and this permission notice shall be included in all
echo copies or substantial portions of the Software.
echo.
echo THE SOFTWARE IS PROVIDED ^"AS IS^", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
echo IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
echo FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
echo AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
echo LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
echo OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
echo SOFTWARE.
echo -------------------------------------------------------------------------------
echo */
echo.
echo spool install.log
echo.
echo set feedback off
echo set define off
echo.
echo prompt ###################################
echo prompt # _____ _____ _____ _ __ #
echo prompt # ^| __ \ ^|_ _^| / ____^|^| ^|/ / #
echo prompt # ^| ^|__^) ^| ^| ^| ^| ^(___ ^| ' / #
echo prompt # ^| _ / ^| ^| \___ \ ^| ^< #
echo prompt # ^| ^| \ \ _^| ^|_ ____^) ^|^| . \ #
echo prompt # ^|_^| \_\^|_____^|^|_____/ ^|_^|\_\ #
echo prompt # #
echo prompt # jtsoya539 #
echo prompt ###################################
echo.
echo prompt
echo prompt ===================================
echo prompt Tests installation started
echo prompt ===================================
echo prompt
echo.
echo prompt
echo prompt Creating package specs...
echo prompt -----------------------------------
echo prompt
if exist "%TEST_DIR%\package_specs\*.spc" (
dir /b "%TEST_DIR%\package_specs\*.spc" > "%TEMP_DIR%\tests_package_specs.txt"
sort "%TEMP_DIR%\tests_package_specs.txt" /o "%TEMP_DIR%\tests_package_specs_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\tests_package_specs_sorted.txt) do (
echo @@package_specs/%%f
)
)
echo.
echo prompt
echo prompt Creating package bodies...
echo prompt -----------------------------------
echo prompt
if exist "%TEST_DIR%\package_bodies\*.bdy" (
dir /b "%TEST_DIR%\package_bodies\*.bdy" > "%TEMP_DIR%\tests_package_bodies.txt"
sort "%TEMP_DIR%\tests_package_bodies.txt" /o "%TEMP_DIR%\tests_package_bodies_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\tests_package_bodies_sorted.txt) do (
echo @@package_bodies/%%f
)
)
echo.
echo prompt
echo prompt ===================================
echo prompt Tests installation completed
echo prompt ===================================
echo prompt
echo.
echo spool off
) > "%TEST_DIR%\install.sql"
echo Generating tests uninstall script...
(
echo /*
echo --------------------------------- MIT License ---------------------------------
echo Copyright ^(c^) 2019 - 2026 jtsoya539, DamyGenius and RISK contributors
echo.
echo Permission is hereby granted, free of charge, to any person obtaining a copy
echo of this software and associated documentation files ^(the ^"Software^"^), to deal
echo in the Software without restriction, including without limitation the rights
echo to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
echo copies of the Software, and to permit persons to whom the Software is
echo furnished to do so, subject to the following conditions:
echo.
echo The above copyright notice and this permission notice shall be included in all
echo copies or substantial portions of the Software.
echo.
echo THE SOFTWARE IS PROVIDED ^"AS IS^", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
echo IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
echo FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
echo AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
echo LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
echo OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
echo SOFTWARE.
echo -------------------------------------------------------------------------------
echo */
echo.
echo spool uninstall.log
echo.
echo set feedback off
echo set define off
echo.
echo prompt ###################################
echo prompt # _____ _____ _____ _ __ #
echo prompt # ^| __ \ ^|_ _^| / ____^|^| ^|/ / #
echo prompt # ^| ^|__^) ^| ^| ^| ^| ^(___ ^| ' / #
echo prompt # ^| _ / ^| ^| \___ \ ^| ^< #
echo prompt # ^| ^| \ \ _^| ^|_ ____^) ^|^| . \ #
echo prompt # ^|_^| \_\^|_____^|^|_____/ ^|_^|\_\ #
echo prompt # #
echo prompt # jtsoya539 #
echo prompt ###################################
echo.
echo prompt
echo prompt ===================================
echo prompt Tests uninstallation started
echo prompt ===================================
echo prompt
echo.
echo prompt
echo prompt Dropping packages...
echo prompt -----------------------------------
echo prompt
if exist "%TEST_DIR%\package_bodies\*.bdy" (
dir /b "%TEST_DIR%\package_bodies\*.bdy" > "%TEMP_DIR%\tests_package_bodies_uninstall.txt"
sort "%TEMP_DIR%\tests_package_bodies_uninstall.txt" /o "%TEMP_DIR%\tests_package_bodies_uninstall_sorted.txt"
for /f "tokens=*" %%f in (%TEMP_DIR%\tests_package_bodies_uninstall_sorted.txt) do (
for /f "tokens=1* delims=." %%a in ("%%~nf") do echo drop package %%a;
)
)
echo.
echo prompt
echo prompt Purging recycle bin...
echo prompt -----------------------------------
echo prompt
echo purge recyclebin;
echo.
echo prompt
echo prompt ===================================
echo prompt Tests uninstallation completed
echo prompt ===================================
echo prompt
echo.
echo spool off
) > "%TEST_DIR%\uninstall.sql"
)
:: Clean up temporary directory
rmdir /s /q "%TEMP_DIR%"
echo.
echo Generated files:
for /d %%d in ("%BASE_DIR%\*") do (
echo Module: %%~nxd
echo - %%d\install.sql
echo - %%d\uninstall.sql
)
echo Done!
pause