evt-message_store-postgres-database 0.3.0.0 → 0.4.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7588b97db4e6f186b6e39788e962d44e3c55cf450cf3317865147af48ffed4d7
4
- data.tar.gz: 83001e6fa7d491d558c84f984f1d249380aea59f602606334d13b028c9fb2d94
3
+ metadata.gz: fee61d1167444b80c9b38b26b0f26f1ebdc604c354c5f2acd744d4d7f77867b7
4
+ data.tar.gz: 8af326596da6f662bd3ab8090c8fb187331e600f6169353ff7cf4c3cdfae8cf5
5
5
  SHA512:
6
- metadata.gz: f5bb2de5620dfb54eb5f816f67d8f911d25caafb83eebe0a43daeb5b6f6dc1b4ff359d449eb02ab41930c3f2228b3bdace16802601098f0a40c2352206aff877
7
- data.tar.gz: ede86fdcdab1d79d13e46ddfc60d6c4bd98288e3799c5de55a8493c36e10ec4e6ba5c958828ddad1aea9f315a388841b2b2043ac31feca77448d84f4c3393375
6
+ metadata.gz: 92ade25f7017c6455ae7350efbb73b30128445ad44458936b3c2b009d39f60d0b749d61802a630a61efe4f8b8a6ee9a6194f39771011f86de49b091d2dcdcbdb
7
+ data.tar.gz: 8585cb96a901fcdda4c9835c394d47d546f21c2c45500c45a18f3c527b408831e021985efb7bde436e7979e554725a75ee72b4e4022a48e5a8c0610f4d59ff6d
@@ -25,16 +25,6 @@ else
25
25
  fi
26
26
  echo "Database name is: $database"
27
27
 
28
- default_table_name=messages
29
-
30
- if [ -z ${TABLE_NAME+x} ]; then
31
- echo "(TABLE_NAME is not set)"
32
- table=$default_table_name
33
- else
34
- table=$TABLE_NAME
35
- fi
36
- echo "Table name is: $table"
37
-
38
28
  echo
39
29
 
40
- psql $database -c "TRUNCATE $table RESTART IDENTITY;"
30
+ psql $database -U $user -c "TRUNCATE messages RESTART IDENTITY;"
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ echo
6
+
7
+ default_name=message_store
8
+
9
+ if [ -z ${DATABASE_USER+x} ]; then
10
+ echo "(DATABASE_USER is not set)"
11
+ user=$default_name
12
+ else
13
+ user=$DATABASE_USER
14
+ fi
15
+ echo "Database user is: $user"
16
+
17
+ if [ -z ${DATABASE_NAME+x} ]; then
18
+ echo "(DATABASE_NAME is not set)"
19
+ database=$default_name
20
+ else
21
+ database=$DATABASE_NAME
22
+ fi
23
+ echo "Database name is: $database"
24
+
25
+ if [ -z ${STREAM_NAME+x} ]; then
26
+ echo "(STREAM_NAME is not set)"
27
+ stream_name=''
28
+ else
29
+ stream_name=$STREAM_NAME
30
+ echo "Stream name is: $STREAM_NAME"
31
+ fi
32
+
33
+ echo
34
+ echo "Stream Summary"
35
+ echo "= = ="
36
+ echo
37
+
38
+ if [ -z $stream_name ]; then
39
+ psql $database -U $user -P pager=off -c "SELECT DISTINCT stream_name, count(stream_name) FROM messages GROUP BY stream_name ORDER BY count DESC;"
40
+ psql $database -U $user -P pager=off -c "SELECT count(*) FROM messages;"
41
+ else
42
+ psql $database -U $user -P pager=off -c "SELECT DISTINCT stream_name, count(stream_name) FROM messages WHERE stream_name LIKE '%$stream_name%' GROUP BY stream_name ORDER BY count DESC;"
43
+ psql $database -U $user -P pager=off -c "SELECT count(*) FROM messages WHERE stream_name LIKE '%$stream_name%';"
44
+ fi
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ echo
6
+
7
+ default_name=message_store
8
+
9
+ if [ -z ${DATABASE_USER+x} ]; then
10
+ echo "(DATABASE_USER is not set)"
11
+ user=$default_name
12
+ else
13
+ user=$DATABASE_USER
14
+ fi
15
+ echo "Database user is: $user"
16
+
17
+ if [ -z ${DATABASE_NAME+x} ]; then
18
+ echo "(DATABASE_NAME is not set)"
19
+ database=$default_name
20
+ else
21
+ database=$DATABASE_NAME
22
+ fi
23
+ echo "Database name is: $database"
24
+
25
+ if [ -z ${STREAM_NAME+x} ]; then
26
+ echo "(STREAM_NAME is not set)"
27
+ stream_name=''
28
+ else
29
+ stream_name=$STREAM_NAME
30
+ echo "Stream name is: $STREAM_NAME"
31
+ fi
32
+
33
+ echo
34
+ echo "Type Summary"
35
+ echo "= = ="
36
+ echo
37
+
38
+ if [ -z $stream_name ]; then
39
+ psql $database -U $user -P pager=off -c "SELECT DISTINCT type, count(type) FROM messages GROUP BY type ORDER BY count DESC;"
40
+ psql $database -U $user -P pager=off -c "SELECT count(*) FROM messages;"
41
+ else
42
+ psql $database -U $user -P pager=off -c "SELECT DISTINCT type, count(type) FROM messages WHERE stream_name LIKE '%$stream_name%' GROUP BY type ORDER BY count DESC;"
43
+ psql $database -U $user -P pager=off -c "SELECT count(*) FROM messages WHERE stream_name LIKE '%$stream_name%';"
44
+ fi
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ root = File.expand_path '../database', __dir__
4
+ script_filename = 'clear-messages.sh'
5
+ script_filepath = File.join root, script_filename
6
+
7
+ system script_filepath
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ root = File.expand_path '../database', __dir__
4
+ script_filename = 'print-stream-summary.sh'
5
+ script_filepath = File.join root, script_filename
6
+
7
+ system script_filepath
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ root = File.expand_path '../database', __dir__
4
+ script_filename = 'print-type-summary.sh'
5
+ script_filepath = File.join root, script_filename
6
+
7
+ system script_filepath
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-message_store-postgres-database
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.0
4
+ version: 0.4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project
8
8
  autorequire:
9
9
  bindir: scripts
10
10
  cert_chain: []
11
- date: 2018-06-25 00:00:00.000000000 Z
11
+ date: 2018-07-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: " "
14
14
  email: opensource@eventide-project.org
@@ -19,14 +19,17 @@ executables:
19
19
  - evt-pg-create-db
20
20
  - evt-pg-install-database-functions
21
21
  - evt-pg-open-database-scripts-dir
22
+ - evt-pg-clear-messages
22
23
  - evt-pg-recreate-db
24
+ - evt-pg-print-type-summary
25
+ - evt-pg-print-stream-summary
23
26
  extensions: []
24
27
  extra_rdoc_files: []
25
28
  files:
26
29
  - database/benchmark.sh
27
30
  - database/benchmark_get.sql
28
31
  - database/benchmark_write.sql
29
- - database/clear-events-table.sh
32
+ - database/clear-messages.sh
30
33
  - database/extensions.sql
31
34
  - database/functions/category.sql
32
35
  - database/functions/get-category-messages.sql
@@ -42,15 +45,20 @@ files:
42
45
  - database/install-functions.sh
43
46
  - database/install.sh
44
47
  - database/print-messages.sh
48
+ - database/print-stream-summary.sh
49
+ - database/print-type-summary.sh
45
50
  - database/table/messages-table.sql
46
51
  - database/types/message.sql
47
52
  - database/uninstall.sh
48
53
  - database/write-test-message.sh
54
+ - scripts/evt-pg-clear-messages
49
55
  - scripts/evt-pg-create-db
50
56
  - scripts/evt-pg-delete-db
51
57
  - scripts/evt-pg-install-database-functions
52
58
  - scripts/evt-pg-open-database-scripts-dir
53
59
  - scripts/evt-pg-print-messages
60
+ - scripts/evt-pg-print-stream-summary
61
+ - scripts/evt-pg-print-type-summary
54
62
  - scripts/evt-pg-recreate-db
55
63
  - scripts/evt-pg-write-test-message
56
64
  homepage: https://github.com/eventide-project/message-store-postgres-database