ez 1.9.5 → 1.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -14
- data/lib/ez/schema_modifier.rb +1 -1
- data/lib/ez/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d5f08d735f9d0fcb9f1e403ffefefbd428d73df
|
4
|
+
data.tar.gz: 1e14407a8a84fd64cd0fd6a0d5d2d9c7c8386e52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1545fd8ce47e83a19bf548b243946990bf2da2bd4855e4c90e16d00ece86b8fc3b1691b109700959252c9f5b1c169958db02b06f2eece06423d4ff881aa18171
|
7
|
+
data.tar.gz: 95e42626242635526809c63146e2f6b6fa80207a1fda82cd262fffccc60f4734c1470fe5aff0f8b5f008f812ad329960d06ccd955f6e66f2c4a3004915a4d406
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Easy domain modeling in Rails without migrations.
|
4
4
|
|
5
|
-
**Version 1.9.
|
5
|
+
**Version 1.9.6**
|
6
6
|
|
7
7
|
*For educational purposes only.*
|
8
8
|
|
@@ -13,9 +13,10 @@ _NOTE: For Rails < 5.0, use version 1.3_.
|
|
13
13
|
### Highlights
|
14
14
|
|
15
15
|
* Applies schema changes based on a file named `db/models.yml`.
|
16
|
-
* Schema
|
17
|
-
*
|
18
|
-
*
|
16
|
+
* Schema migrations are determined automatically and applied to the database.
|
17
|
+
* Optionally generates routes, controllers, and/or views based on the models.
|
18
|
+
* Schema migrations are applied by running `rails server`, `rails console`, or by typing `reload!` in the console. `rails db:migrate` is not affected.
|
19
|
+
* Embraces Rails column naming conventions by inferring columns types based on the name.
|
19
20
|
* Enhances the Rails Console with customized AwesomePrint and Hirb integration
|
20
21
|
* Adds two new ActiveRecord methods: `.sample(n = 1)` and `.none?`
|
21
22
|
|
@@ -27,11 +28,14 @@ gem 'ez'
|
|
27
28
|
```
|
28
29
|
|
29
30
|
Start the server or console to force the initial generation of
|
30
|
-
`db/models.yml
|
31
|
+
`db/models.yml`.
|
31
32
|
|
32
|
-
|
33
|
+
If a file named `.ez` in the project directory is present, or in the user's home folder,
|
34
|
+
it controls the behavior of the gem.
|
33
35
|
|
34
|
-
|
36
|
+
Alternatively, you can run `rails ez:generate_yml` to generate these files without running your app.
|
37
|
+
|
38
|
+
### Usage and Configuration
|
35
39
|
|
36
40
|
1. Use `db/models.yml` to define your schema. Database schema changes are applied directly without affecting migrations. (`rails db:migrate` will also trigger the changes).
|
37
41
|
2. Foreign-key indexes are generated automatically.
|
@@ -48,7 +52,7 @@ Alternatively, you can run `rails db:migrate` to generate these files without ru
|
|
48
52
|
|controllers|true|Generates one controller per model with 7 empty methods.
|
49
53
|
|views|true|Generates the view folder for each model, with 7 empty views.
|
50
54
|
|
51
|
-
## Development vs Production
|
55
|
+
## WARNING! Development vs Production
|
52
56
|
|
53
57
|
Renaming a column in `db/models.yml` appear to the gem as if you dropped
|
54
58
|
the old column and created a new column. **You will lose any data you
|
@@ -56,8 +60,9 @@ had in that column**. Same goes for renaming models: the old table
|
|
56
60
|
will be dropped.
|
57
61
|
|
58
62
|
In production, this could be catastrophic. Therefore, this gem will
|
59
|
-
not delete tables or columns in production
|
60
|
-
columns. This could be problematic
|
63
|
+
**not delete tables or columns in production**, but only add tables and add
|
64
|
+
columns. This could be problematic for apps that need to drop tables
|
65
|
+
or columns from the production database, but this hopefully an edge case.
|
61
66
|
|
62
67
|
|
63
68
|
## Syntax Guide for `db/models.yml`
|
@@ -151,9 +156,20 @@ to control the schema. It is ok to use both migrations
|
|
151
156
|
and `models.yml`, but be aware of the following:
|
152
157
|
|
153
158
|
* If at least one migration file is detected, this gem will not
|
154
|
-
|
155
|
-
it
|
156
|
-
*
|
159
|
+
remove tables in development mode that would normally removed via `models.yml` because
|
160
|
+
it is not possible to know if the table is controlled by migrations or not.
|
161
|
+
* Wherever possible, it's best to translate a migration required for
|
157
162
|
a third-party gem (say, for Devise) into an entry in models.yml
|
158
163
|
so that everything is managed in one place.
|
159
|
-
Pull requests for integrating
|
164
|
+
* Pull requests for integrating new features into `ez` are encouraged.
|
165
|
+
|
166
|
+
### Switching To Rails Migrations
|
167
|
+
|
168
|
+
There will (hopefully) come a time when the student wishes to graduate to
|
169
|
+
proper database migrations, probably for managing a production application.
|
170
|
+
To switch to normal Rails migrations:
|
171
|
+
|
172
|
+
1. Remove the `ez` gem and run `bundle install`
|
173
|
+
2. Delete any `.ez` file in the project root
|
174
|
+
|
175
|
+
From this point forward, migrations can be used as expected.
|
data/lib/ez/schema_modifier.rb
CHANGED
data/lib/ez/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ez
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Cohen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|