neo4j_bolt 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -1
- data/bin/neo4j_bolt +46 -0
- data/lib/neo4j_bolt/version.rb +1 -1
- 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: 31a315fe0d04141dd4d3315da9b25f6b42e6571b799dee6f6fab39a4ced605bd
|
4
|
+
data.tar.gz: 4ac80c13abd2c1172f6786522342f8dd2d965c9352ae34d3011aeb38b6695dbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e3db7bdadcc4c2ec69ef531466eb2d9696963a7d6709b7f7a198cfbf4c6ccf9037ccfca166d4c9bac5dd07426910cc1e7aa11f52de7785e4f1d697cabfe51d9
|
7
|
+
data.tar.gz: 1f7fab9c9b4f78271d36bf5baee3d480bccfc45245d634547d8b146c3c0dbbc75b2f3616689c96717f3cabefceb5d2e1129ead5ac0d6cec1f4aef1afafbd46a3
|
data/Gemfile.lock
CHANGED
data/bin/neo4j_bolt
CHANGED
@@ -83,6 +83,52 @@ class App
|
|
83
83
|
|
84
84
|
# --------------------------------------------
|
85
85
|
|
86
|
+
desc 'Show or remove constraints and indexes'
|
87
|
+
# long_desc 'Clear all nodes and relationships'
|
88
|
+
command :index do |c|
|
89
|
+
c.command :ls do |c2|
|
90
|
+
c2.action do |global_options, options, args|
|
91
|
+
neo4j_query("SHOW ALL CONSTRAINTS") do |row|
|
92
|
+
# STDERR.puts row.to_yaml
|
93
|
+
puts "#{row['type']} #{row['name']} #{row['labelsOrTypes'].join('/')}/#{row['properties'].join('/')}"
|
94
|
+
end
|
95
|
+
neo4j_query("SHOW ALL INDEXES") do |row|
|
96
|
+
# STDERR.puts row.to_yaml
|
97
|
+
puts "#{row['uniqueness']} #{row['entityType']} #{row['state']} #{row['populationPercent']}% #{row['name']} #{row['labelsOrTypes'].join('/')}/#{row['properties'].join('/')}"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
c.command :rm do |c2|
|
102
|
+
c2.switch [:f, :force], :required => true, :negatable => false, :desc => 'Specify --force to really remove all constraints and indexes'
|
103
|
+
c2.action do |global_options, options, args|
|
104
|
+
if options[:force]
|
105
|
+
all_constraints = []
|
106
|
+
all_indexes = []
|
107
|
+
neo4j_query("SHOW ALL CONSTRAINTS") do |row|
|
108
|
+
all_constraints << row['name']
|
109
|
+
end
|
110
|
+
neo4j_query("SHOW ALL INDEXES") do |row|
|
111
|
+
all_indexes << row['name']
|
112
|
+
end
|
113
|
+
transaction do
|
114
|
+
all_constraints.each do |name|
|
115
|
+
STDERR.puts "Removing constraint #{name}"
|
116
|
+
neo4j_query("DROP CONSTRAINT #{name} IF EXISTS")
|
117
|
+
end
|
118
|
+
all_indexes.each do |name|
|
119
|
+
STDERR.puts "Removing index #{name}"
|
120
|
+
neo4j_query("DROP INDEX #{name} IF EXISTS")
|
121
|
+
end
|
122
|
+
end
|
123
|
+
else
|
124
|
+
STDERR.puts "Doing nothing unless you specify --force."
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
# --------------------------------------------
|
131
|
+
|
86
132
|
desc 'Visualize database'
|
87
133
|
long_desc 'Generate a GraphViz-formatted visual representation of the database'
|
88
134
|
command :visualize do |c|
|
data/lib/neo4j_bolt/version.rb
CHANGED