Skip to content

Instantly share code, notes, and snippets.

@openbrian
Last active October 20, 2019 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save openbrian/f89038bbc1d5218c7d1bf83a97c170e2 to your computer and use it in GitHub Desktop.
Save openbrian/f89038bbc1d5218c7d1bf83a97c170e2 to your computer and use it in GitHub Desktop.
rake database dependency

task dependency diagram for active-record-5.2.3/lib/active_record/railties/database.rake.

All dependencies on load_config, check_protected_environments, and environment are omitted because they are numerous and distort the diagram.

black lines are dependencies gray lines are invocations, where these are obvious (like calling a .invoke method).

digraph {
"environment";
subgraph cluster_db {
label = "db";
"db:environment:set";
"db:check_protected_environments";
"db:load_config";
subgraph cluster_create {
label = "create";
"db:create:all";
}
"db:create";
subgraph cluster_drop {
label = "drop";
"db:drop:all";
}
"db:drop" -> "db:drop:_unsafe" [label="invoke", color=gray];
"db:drop";
"db:drop_unsafe";
subgraph cluster_purge {
label = "purge";
"db:purge:all";
}
"db:purge";
"db:migrate";
"db:migrate" -> "db:_dump" [label="invoke", color=gray];
"db:_dump";
"db:_dump" -> "db:schema:dump" [label="invoke", color=gray];
"db:_dump" -> "db:structure:dump" [label="invoke", color=gray];
subgraph cluster_migrate {
label = "migrate";
"db:migrate:redo";
"db:migrate:reset";
"db:migrate:up";
"db:migrate:down";
"db:migrate:status";
"db:migrate:redo" -> "db:migrate:down" [label="invoke", color=gray];
"db:migrate:redo" -> "db:migrate:up" [label="invoke", color=gray];
}
"db:migrate:up" -> "db:_dump" [label="invoke", color=gray];
"db:migrate:down" -> "db:_dump" [label="invoke", color=gray];
"db:migrate:reset" -> "db:drop";
"db:migrate:reset" -> "db:create";
"db:migrate:reset" -> "db:migrate";
"db:rollback";
"db:rollback" -> "db:_dump" [label="invoke", color=gray];
"db:forward";
"db:forward" -> "db:_dump" [label="invoke", color=gray];
"db:reset" -> "db:drop";
"db:reset" -> "db:setup";
"db:charset";
"db:collation";
"db:version";
"db:abort_if_pending_migrations";
"db:setup" -> "db:schema:load_if_ruby";
"db:setup" -> "db:structure:load_if_sql";
"db:setup" -> seed;
"db:seed";
"db:seed" -> "db:abort_if_pending_migrations" [label="invoke", color=gray];
subgraph cluster_fixtures {
label = "fixtures";
"db:fixtures:load";
"db:fixtures:identify";
}
subgraph cluster_schema {
label = "schema";
"db:schema:dump";
"db:schema:load";
"db:schema:load_if_ruby";
subgraph cluster_cache {
label = "cache";
"db:schema:cache:dump";
"db:schema:cache:clear";
}
}
subgraph cluster_structure {
label = "structure";
"db:structure:dump";
"db:structure:load";
"db:structure:load_if_sql";
}
"db:structure:load";
subgraph cluster_test {
label = "test";
"db:test:load";
"db:test:load_schema";
"db:test:load_structure";
"db:test:purge";
"db:test:prepare";
}
"db:test:load" -> "db:test:purge";
"db:test:load" -> "db:test:load_schema" [label="invoke", color=gray];
"db:test:load" -> "db:test:load_structure" [label="invoke", color=gray];
"db:test:load_schema" -> "db:test:purge";
"db:test:load_structure" -> "db:test:purge";
"db:test:purge";
"db:test:prepare" -> "db:test:load" [label="invoke", color=gray];
}
// "db:load_config" -> "environment";
// "db:schema:load_if_ruby" -> "environment";
"db:schema:load_if_ruby" -> "db:schema:load" [label="invoke", color=gray];
// "db:structure:load_if_sql" -> "environment";
"db:structure:load_if_sql" -> "db:structure:load" [label="invoke", color=gray];
}
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment