neetob 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/neetob/cli/code/audit.rb +25 -0
- data/lib/neetob/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: 2e9f4f9a2ee60826478456769b0ec2e13822cefde51c5169281a30d1dceea6f4
|
4
|
+
data.tar.gz: 9266e85257bede98e0591aa16be29ca957728f6a83171645f99361a69066667d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32214fd0f0ae2e81b4163a71f3a73e84402e76bb98fdbeb3be19d3ec415c62dc3a9ef792f2ddcecd0c67016fb262725814ba9419d487e7a56788068dd659f427
|
7
|
+
data.tar.gz: c78d355e36cefdb274ccd8b5820299c4a188343f10af7bf03c54c357bd1f4bfa70a1290135c80137f3d51392b8d2a9d35c4906f7840a2689506d2e085914b3da
|
data/Gemfile.lock
CHANGED
@@ -26,6 +26,7 @@ module Neetob
|
|
26
26
|
has_found_tables_without_uuid = true
|
27
27
|
print_app_and_tables(app, tables_without_uuid)
|
28
28
|
end
|
29
|
+
verify_unique_email_index(db_schema)
|
29
30
|
rescue Octokit::NotFound
|
30
31
|
ui.error("There is no \"db/schema.rb\" file in the \"#{app}\" app.")
|
31
32
|
rescue StandardError => e
|
@@ -44,6 +45,30 @@ module Neetob
|
|
44
45
|
end
|
45
46
|
end
|
46
47
|
|
48
|
+
def verify_unique_email_index(db_schema)
|
49
|
+
index_pattern = /
|
50
|
+
create_table\s+"users".*?
|
51
|
+
(
|
52
|
+
t\.index\s+\[
|
53
|
+
\s*"email"\s*
|
54
|
+
\],\s+
|
55
|
+
name:\s*"index_users_on_email"
|
56
|
+
|
|
57
|
+
t\.index\s+\[
|
58
|
+
\s*"email"\s*,\s*"organization_id"\s*
|
59
|
+
\],\s+
|
60
|
+
name:\s*"index_users_on_email_and_organization_id"\s*,\s+
|
61
|
+
unique:\s*true
|
62
|
+
)
|
63
|
+
/mx
|
64
|
+
|
65
|
+
if db_schema.match(index_pattern)
|
66
|
+
ui.success("\nUsers are indexed properly")
|
67
|
+
else
|
68
|
+
ui.error("\nUsers are not indexed")
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
47
72
|
def print_app_and_tables(app, tables)
|
48
73
|
ui.info("\n#{app}:-")
|
49
74
|
tables.each do |table|
|
data/lib/neetob/version.rb
CHANGED