-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit-databases.sql
More file actions
75 lines (67 loc) · 1.91 KB
/
init-databases.sql
File metadata and controls
75 lines (67 loc) · 1.91 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
-- Database Initialization Script for Cherry FastFood System
-- This script creates all required databases for the microservices
-- Create databases if they don't exist
IF NOT EXISTS (SELECT name FROM sys.databases WHERE name = 'Cherry_Auth')
BEGIN
CREATE DATABASE Cherry_Auth;
PRINT 'Database Cherry_Auth created successfully.';
END
ELSE
BEGIN
PRINT 'Database Cherry_Auth already exists.';
END
IF NOT EXISTS (SELECT name FROM sys.databases WHERE name = 'Cherry_Product')
BEGIN
CREATE DATABASE Cherry_Product;
PRINT 'Database Cherry_Product created successfully.';
END
ELSE
BEGIN
PRINT 'Database Cherry_Product already exists.';
END
IF NOT EXISTS (SELECT name FROM sys.databases WHERE name = 'Cherry_Coupon')
BEGIN
CREATE DATABASE Cherry_Coupon;
PRINT 'Database Cherry_Coupon created successfully.';
END
ELSE
BEGIN
PRINT 'Database Cherry_Coupon already exists.';
END
IF NOT EXISTS (SELECT name FROM sys.databases WHERE name = 'Cherry_ShoppingCart')
BEGIN
CREATE DATABASE Cherry_ShoppingCart;
PRINT 'Database Cherry_ShoppingCart created successfully.';
END
ELSE
BEGIN
PRINT 'Database Cherry_ShoppingCart already exists.';
END
IF NOT EXISTS (SELECT name FROM sys.databases WHERE name = 'Cherry_Order')
BEGIN
CREATE DATABASE Cherry_Order;
PRINT 'Database Cherry_Order created successfully.';
END
ELSE
BEGIN
PRINT 'Database Cherry_Order already exists.';
END
IF NOT EXISTS (SELECT name FROM sys.databases WHERE name = 'Cherry_Email')
BEGIN
CREATE DATABASE Cherry_Email;
PRINT 'Database Cherry_Email created successfully.';
END
ELSE
BEGIN
PRINT 'Database Cherry_Email already exists.';
END
IF NOT EXISTS (SELECT name FROM sys.databases WHERE name = 'Cherry_Reward')
BEGIN
CREATE DATABASE Cherry_Reward;
PRINT 'Database Cherry_Reward created successfully.';
END
ELSE
BEGIN
PRINT 'Database Cherry_Reward already exists.';
END
PRINT 'All databases initialization completed!';