evt-message_store-postgres-database 0.1.4.0 → 0.1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/database/install-functions.sh +8 -9
- data/database/install.sh +25 -37
- data/database/uninstall.sh +2 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e20eb6c185be000bee800ee5b9293ecc0093b79ce44201933f99aee79edb0b3
|
4
|
+
data.tar.gz: 8f415e22863f1af77ede60271a6e73570ead155cdf2db4943062ffc5b2b7d2d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 876602410920f8e58af32e56d061527c209553e92518b7a113c81a9776426cecc8c3405a00ec8a5fba9b685d8cb1bc51efba626f672f736c45fd10ec467ed090
|
7
|
+
data.tar.gz: 0aceb36d1438101d8597830cf8c163c64617d31806142facd523aac95082746606b704f8b4cd7079abecb86eccfb3f09f294228a7be41bbc90b457dce3d700de
|
@@ -2,11 +2,6 @@
|
|
2
2
|
|
3
3
|
set -e
|
4
4
|
|
5
|
-
echo
|
6
|
-
echo "Installing Functions"
|
7
|
-
echo "= = ="
|
8
|
-
echo
|
9
|
-
|
10
5
|
default_name=message_store
|
11
6
|
|
12
7
|
if [ -z ${DATABASE_NAME+x} ]; then
|
@@ -15,8 +10,7 @@ if [ -z ${DATABASE_NAME+x} ]; then
|
|
15
10
|
else
|
16
11
|
database=$DATABASE_NAME
|
17
12
|
fi
|
18
|
-
|
19
|
-
echo
|
13
|
+
echo "Database name is: $database"
|
20
14
|
|
21
15
|
function script_dir {
|
22
16
|
val="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
@@ -25,7 +19,6 @@ function script_dir {
|
|
25
19
|
|
26
20
|
function create-types {
|
27
21
|
base=$(script_dir)
|
28
|
-
echo "Creating types..."
|
29
22
|
|
30
23
|
echo "message type"
|
31
24
|
psql $database -f $base/types/message.sql
|
@@ -34,7 +27,6 @@ function create-types {
|
|
34
27
|
}
|
35
28
|
|
36
29
|
function create-functions {
|
37
|
-
echo "Installing functions..."
|
38
30
|
base=$(script_dir)
|
39
31
|
|
40
32
|
echo "hash_64 function"
|
@@ -61,5 +53,12 @@ function create-functions {
|
|
61
53
|
echo
|
62
54
|
}
|
63
55
|
|
56
|
+
echo
|
57
|
+
echo "Creating Types"
|
58
|
+
echo "- - -"
|
64
59
|
create-types
|
60
|
+
|
61
|
+
echo
|
62
|
+
echo "Creating Functions"
|
63
|
+
echo "- - -"
|
65
64
|
create-functions
|
data/database/install.sh
CHANGED
@@ -15,6 +15,7 @@ if [ -z ${DATABASE_USER+x} ]; then
|
|
15
15
|
else
|
16
16
|
user=$DATABASE_USER
|
17
17
|
fi
|
18
|
+
echo "Database user is: $user"
|
18
19
|
|
19
20
|
if [ -z ${DATABASE_NAME+x} ]; then
|
20
21
|
echo "(DATABASE_NAME is not set. Default will be used.)"
|
@@ -22,18 +23,16 @@ if [ -z ${DATABASE_NAME+x} ]; then
|
|
22
23
|
else
|
23
24
|
database=$DATABASE_NAME
|
24
25
|
fi
|
26
|
+
echo "Database name is: $database"
|
25
27
|
|
26
28
|
echo
|
27
29
|
|
28
30
|
function create-user {
|
29
|
-
echo "Database user is: $user"
|
30
31
|
createuser -s $user
|
31
32
|
echo
|
32
33
|
}
|
33
34
|
|
34
35
|
function create-database {
|
35
|
-
echo "Database name is: $database"
|
36
|
-
echo "Creating database \"$database\"..."
|
37
36
|
createdb $database
|
38
37
|
echo
|
39
38
|
}
|
@@ -44,21 +43,18 @@ function script_dir {
|
|
44
43
|
}
|
45
44
|
|
46
45
|
function create-extensions {
|
47
|
-
echo "Creating extensions..."
|
48
46
|
base=$(script_dir)
|
49
47
|
psql $database -f $base/extensions.sql
|
50
48
|
echo
|
51
49
|
}
|
52
50
|
|
53
51
|
function create-table {
|
54
|
-
echo "Creating messages table..."
|
55
52
|
psql $database -f $base/table/messages-table.sql
|
56
53
|
echo
|
57
54
|
}
|
58
55
|
|
59
56
|
function create-types {
|
60
57
|
base=$(script_dir)
|
61
|
-
echo "Creating types..."
|
62
58
|
|
63
59
|
echo "message type"
|
64
60
|
psql $database -f $base/types/message.sql
|
@@ -66,36 +62,7 @@ function create-types {
|
|
66
62
|
echo
|
67
63
|
}
|
68
64
|
|
69
|
-
function create-functions {
|
70
|
-
echo "Creating functions..."
|
71
|
-
base=$(script_dir)
|
72
|
-
|
73
|
-
echo "hash_64 function"
|
74
|
-
psql $database -f $base/functions/hash-64.sql
|
75
|
-
|
76
|
-
echo "category function"
|
77
|
-
psql $database -f $base/functions/category.sql
|
78
|
-
|
79
|
-
echo "stream_version function"
|
80
|
-
psql $database -f $base/functions/stream-version.sql
|
81
|
-
|
82
|
-
echo "write_message function"
|
83
|
-
psql $database -f $base/functions/write-message.sql
|
84
|
-
|
85
|
-
echo "get_stream_messages function"
|
86
|
-
psql $database -f $base/functions/get-stream-messages.sql
|
87
|
-
|
88
|
-
echo "get_category_messages function"
|
89
|
-
psql $database -f $base/functions/get-category-messages.sql
|
90
|
-
|
91
|
-
echo "get_last_message function"
|
92
|
-
psql $database -f $base/functions/get-last-message.sql
|
93
|
-
|
94
|
-
echo
|
95
|
-
}
|
96
|
-
|
97
65
|
function create-indexes {
|
98
|
-
echo "Creating indexes..."
|
99
66
|
base=$(script_dir)
|
100
67
|
|
101
68
|
echo "messages_id_idx"
|
@@ -110,10 +77,31 @@ function create-indexes {
|
|
110
77
|
echo
|
111
78
|
}
|
112
79
|
|
80
|
+
echo
|
81
|
+
echo "Creating User: $user"
|
82
|
+
echo "- - -"
|
113
83
|
create-user
|
84
|
+
|
85
|
+
echo
|
86
|
+
echo "Creating Database: $database"
|
87
|
+
echo "- - -"
|
114
88
|
create-database
|
89
|
+
|
90
|
+
|
91
|
+
echo
|
92
|
+
echo "Creating Extensions"
|
93
|
+
echo "- - -"
|
115
94
|
create-extensions
|
95
|
+
|
96
|
+
|
97
|
+
echo
|
98
|
+
echo "Creating Table"
|
99
|
+
echo "- - -"
|
116
100
|
create-table
|
117
|
-
|
118
|
-
|
101
|
+
|
102
|
+
source $base/install-functions.sh
|
103
|
+
|
104
|
+
echo
|
105
|
+
echo "Creating Indexes"
|
106
|
+
echo "- - -"
|
119
107
|
create-indexes
|
data/database/uninstall.sh
CHANGED
@@ -15,6 +15,7 @@ if [ -z ${DATABASE_USER+x} ]; then
|
|
15
15
|
else
|
16
16
|
user=$DATABASE_USER
|
17
17
|
fi
|
18
|
+
echo "Database user is: $user"
|
18
19
|
|
19
20
|
if [ -z ${DATABASE_NAME+x} ]; then
|
20
21
|
echo "(DATABASE_NAME is not set. Default will be used.)"
|
@@ -22,12 +23,10 @@ if [ -z ${DATABASE_NAME+x} ]; then
|
|
22
23
|
else
|
23
24
|
database=$DATABASE_NAME
|
24
25
|
fi
|
25
|
-
|
26
|
+
echo "Database name is: $database"
|
26
27
|
echo
|
27
28
|
|
28
29
|
function delete-user {
|
29
|
-
echo "Database user is: $user"
|
30
|
-
|
31
30
|
user_exists=`psql postgres -qtAXc "SELECT 1 FROM pg_roles WHERE rolname='$user'"`
|
32
31
|
|
33
32
|
if [ "$user_exists" = "1" ]; then
|
@@ -41,8 +40,6 @@ function delete-user {
|
|
41
40
|
}
|
42
41
|
|
43
42
|
function delete-database {
|
44
|
-
echo "Database name is: $database"
|
45
|
-
|
46
43
|
database_exists=`psql postgres -qtAXc "SELECT 1 FROM pg_database WHERE datname='$database'"`
|
47
44
|
|
48
45
|
if [ "$database_exists" = "1" ]; then
|