ru.Bee 2.5.5 → 2.5.7
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/lib/db/test.db +0 -0
- data/lib/rubee/cli/db.rb +6 -0
- data/lib/rubee/models/sequel_object.rb +4 -0
- data/lib/rubee.rb +1 -1
- data/readme.md +20 -0
- 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: 5bc0864116478dee824ed56c454d381716e961ba3d08486b5dedb25eca1c423a
|
|
4
|
+
data.tar.gz: 94e688d7ecb3f4f9b0f06fbb89488e6a4b994320a97335c730aa9a8458757602
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 510be7a66abb2181a83aa28ccda82e4c492dc34bff1d905f926a4f98297c6be05de1320c876e1116999819c1784f8e142da29f4b816c834f1eb87e889af55902
|
|
7
|
+
data.tar.gz: 9c8b9b280b030a860bc42101f03e3fe8065cd22d37efa707f1a77cb9f353c95724533c4dad172eaac59e61977bb3510a3590fdaf2f206015f02c915cee248e78
|
data/lib/db/test.db
CHANGED
|
Binary file
|
data/lib/rubee/cli/db.rb
CHANGED
|
@@ -37,6 +37,12 @@ module Rubee
|
|
|
37
37
|
generate_structure
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
+
def drop_tables(_argv)
|
|
41
|
+
out = Rubee::SequelObject::DB.tables.each { |table| Rubee::SequelObject::DB.drop_table(table, cascade: true) }
|
|
42
|
+
color_puts("These tables has been dropped for #{ENV['RACK_ENV']} env", color: :cyan)
|
|
43
|
+
color_puts(out, color: :gray)
|
|
44
|
+
end
|
|
45
|
+
|
|
40
46
|
def schema(argv)
|
|
41
47
|
target_table_hash = argv[2] ? { argv[2].to_sym => STRUCTURE[argv[2].to_sym] } : nil
|
|
42
48
|
(target_table_hash || STRUCTURE).each do |table_name, table_def|
|
data/lib/rubee.rb
CHANGED
data/readme.md
CHANGED
|
@@ -246,6 +246,26 @@ This will generate the following files
|
|
|
246
246
|
- text, type (varchar(255))
|
|
247
247
|
- user_id, type (INTEGER)
|
|
248
248
|
```
|
|
249
|
+
7. You can also rpint out the schema for the table you need
|
|
250
|
+
```bash
|
|
251
|
+
-> rubee db schema posts
|
|
252
|
+
--- posts
|
|
253
|
+
- id, (PK), type (INTEGER)
|
|
254
|
+
- user_id, type (INTEGER), nullable
|
|
255
|
+
- comment_id, type (INTEGER), nullable
|
|
256
|
+
- created, type (datetime), nullable
|
|
257
|
+
- updated, type (datetime), nullable
|
|
258
|
+
|
|
259
|
+
Foreign keys:
|
|
260
|
+
- comment_id → comments() on delete no_action on update no_action
|
|
261
|
+
- user_id → users() on delete no_action on update no_action
|
|
262
|
+
```
|
|
263
|
+
8. Drop all tables can be handy for development process. But be careful and make sure you pass desired environment
|
|
264
|
+
```bash
|
|
265
|
+
RACK_ENV=test rubee db drop_tables
|
|
266
|
+
These tables has been dropped for test env
|
|
267
|
+
[:companies, :company_clients, :services]
|
|
268
|
+
```
|
|
249
269
|
|
|
250
270
|
[Back to content](#content)
|
|
251
271
|
|