mysql-inspector 0.0.6 → 0.1.0

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.
Files changed (48) hide show
  1. data/.gitignore +5 -3
  2. data/CHANGELOG.md +8 -0
  3. data/Gemfile +6 -0
  4. data/LICENSE +20 -0
  5. data/README.md +82 -0
  6. data/Rakefile +36 -14
  7. data/bin/mysql-inspector +9 -85
  8. data/lib/mysql-inspector.rb +1 -226
  9. data/lib/mysql_inspector.rb +30 -0
  10. data/lib/mysql_inspector/access.rb +64 -0
  11. data/lib/mysql_inspector/ar/access.rb +55 -0
  12. data/lib/mysql_inspector/cli.rb +291 -0
  13. data/lib/mysql_inspector/column.rb +21 -0
  14. data/lib/mysql_inspector/config.rb +82 -0
  15. data/lib/mysql_inspector/constraint.rb +28 -0
  16. data/lib/mysql_inspector/diff.rb +82 -0
  17. data/lib/mysql_inspector/dump.rb +70 -0
  18. data/lib/mysql_inspector/grep.rb +65 -0
  19. data/lib/mysql_inspector/index.rb +25 -0
  20. data/lib/mysql_inspector/migrations.rb +37 -0
  21. data/lib/mysql_inspector/railtie.rb +17 -0
  22. data/lib/mysql_inspector/railties/databases.rake +92 -0
  23. data/lib/mysql_inspector/table.rb +147 -0
  24. data/lib/mysql_inspector/table_part.rb +21 -0
  25. data/lib/mysql_inspector/version.rb +3 -0
  26. data/mysql-inspector.gemspec +17 -36
  27. data/test/fixtures/migrate/111_create_users.rb +7 -0
  28. data/test/fixtures/migrate/222_create_things.rb +9 -0
  29. data/test/helper.rb +125 -0
  30. data/test/helper_ar.rb +37 -0
  31. data/test/helpers/mysql_schemas.rb +82 -0
  32. data/test/helpers/mysql_utils.rb +35 -0
  33. data/test/helpers/string_unindented.rb +13 -0
  34. data/test/mysql_inspector/cli_basics_test.rb +77 -0
  35. data/test/mysql_inspector/cli_diff_test.rb +60 -0
  36. data/test/mysql_inspector/cli_grep_test.rb +74 -0
  37. data/test/mysql_inspector/cli_load_test.rb +43 -0
  38. data/test/mysql_inspector/cli_write_test.rb +58 -0
  39. data/test/mysql_inspector/config_test.rb +14 -0
  40. data/test/mysql_inspector/diff_test.rb +82 -0
  41. data/test/mysql_inspector/dump_test.rb +81 -0
  42. data/test/mysql_inspector/grep_test.rb +61 -0
  43. data/test/mysql_inspector/table_test.rb +123 -0
  44. data/test/mysql_inspector_ar/ar_dump_test.rb +29 -0
  45. data/test/mysql_inspector_ar/ar_migrations_test.rb +47 -0
  46. metadata +123 -49
  47. data/README +0 -48
  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