mysql-inspector 0.0.6 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -3
- data/CHANGELOG.md +8 -0
- data/Gemfile +6 -0
- data/LICENSE +20 -0
- data/README.md +82 -0
- data/Rakefile +36 -14
- data/bin/mysql-inspector +9 -85
- data/lib/mysql-inspector.rb +1 -226
- data/lib/mysql_inspector.rb +30 -0
- data/lib/mysql_inspector/access.rb +64 -0
- data/lib/mysql_inspector/ar/access.rb +55 -0
- data/lib/mysql_inspector/cli.rb +291 -0
- data/lib/mysql_inspector/column.rb +21 -0
- data/lib/mysql_inspector/config.rb +82 -0
- data/lib/mysql_inspector/constraint.rb +28 -0
- data/lib/mysql_inspector/diff.rb +82 -0
- data/lib/mysql_inspector/dump.rb +70 -0
- data/lib/mysql_inspector/grep.rb +65 -0
- data/lib/mysql_inspector/index.rb +25 -0
- data/lib/mysql_inspector/migrations.rb +37 -0
- data/lib/mysql_inspector/railtie.rb +17 -0
- data/lib/mysql_inspector/railties/databases.rake +92 -0
- data/lib/mysql_inspector/table.rb +147 -0
- data/lib/mysql_inspector/table_part.rb +21 -0
- data/lib/mysql_inspector/version.rb +3 -0
- data/mysql-inspector.gemspec +17 -36
- data/test/fixtures/migrate/111_create_users.rb +7 -0
- data/test/fixtures/migrate/222_create_things.rb +9 -0
- data/test/helper.rb +125 -0
- data/test/helper_ar.rb +37 -0
- data/test/helpers/mysql_schemas.rb +82 -0
- data/test/helpers/mysql_utils.rb +35 -0
- data/test/helpers/string_unindented.rb +13 -0
- data/test/mysql_inspector/cli_basics_test.rb +77 -0
- data/test/mysql_inspector/cli_diff_test.rb +60 -0
- data/test/mysql_inspector/cli_grep_test.rb +74 -0
- data/test/mysql_inspector/cli_load_test.rb +43 -0
- data/test/mysql_inspector/cli_write_test.rb +58 -0
- data/test/mysql_inspector/config_test.rb +14 -0
- data/test/mysql_inspector/diff_test.rb +82 -0
- data/test/mysql_inspector/dump_test.rb +81 -0
- data/test/mysql_inspector/grep_test.rb +61 -0
- data/test/mysql_inspector/table_test.rb +123 -0
- data/test/mysql_inspector_ar/ar_dump_test.rb +29 -0
- data/test/mysql_inspector_ar/ar_migrations_test.rb +47 -0
- metadata +123 -49
- data/README +0 -48
- data/VERSION +0 -1
data/README
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
mysql-inspector is a simple tool for diffing and searching mysql dumps.
|
2
|
-
|
3
|
-
Why do I need that?
|
4
|
-
|
5
|
-
It helps you migrate your schema from one version to another.
|
6
|
-
|
7
|
-
Ok, how?
|
8
|
-
|
9
|
-
Say you have a project called zippers. Your development database is called
|
10
|
-
zippers_development. You're working on a branch called smoother, based on
|
11
|
-
master, which adds a new column metal_grade.
|
12
|
-
|
13
|
-
Start by storing the new state of your database.
|
14
|
-
|
15
|
-
% mysql-inspector --target --write zippers_development
|
16
|
-
|
17
|
-
This command says "store the state of the zippers_development database as my
|
18
|
-
target version".
|
19
|
-
|
20
|
-
Now, go back to your master branch and load its database into
|
21
|
-
zippers_development, then dump the contents.
|
22
|
-
|
23
|
-
% mysql-inspector --current --write zippers_development
|
24
|
-
|
25
|
-
Now, in order to write database migrations for master to smoother let's see
|
26
|
-
what changes occurred.
|
27
|
-
|
28
|
-
% mysql-inspector --diff
|
29
|
-
|
30
|
-
[[ show sample output ]]
|
31
|
-
|
32
|
-
Here we see that our target version contains one column that the current
|
33
|
-
version does not. It's easy to write an alter statement, in fact most of the
|
34
|
-
information is right here.
|
35
|
-
|
36
|
-
mysql% alter table zippers add column metal_grade int(11) NOT NULL DEFAULT '0';
|
37
|
-
|
38
|
-
Now we can compare the two again. This time we need to add the --force
|
39
|
-
argument to say that it's ok to overwrite the previous dump. We'll also go
|
40
|
-
ahead and run the diff.
|
41
|
-
|
42
|
-
% mysql-inspector --current --write zippers_development --force --diff
|
43
|
-
|
44
|
-
No differences!
|
45
|
-
|
46
|
-
That was pretty simple. Is there more?
|
47
|
-
|
48
|
-
Sure.
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.0.6
|