{"id":19010293,"url":"https://github.com/railsware/db_structure_ext","last_synced_at":"2025-04-22T23:08:40.721Z","repository":{"id":62556856,"uuid":"2562057","full_name":"railsware/db_structure_ext","owner":"railsware","description":"Extended rails tasks db:structure:dump/load that supports mysql views/triggers/routines","archived":false,"fork":false,"pushed_at":"2012-08-24T12:50:28.000Z","size":129,"stargazers_count":7,"open_issues_count":2,"forks_count":8,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-04-22T23:08:02.761Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/railsware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-10-12T12:05:54.000Z","updated_at":"2023-07-25T13:43:36.000Z","dependencies_parsed_at":"2022-11-03T06:00:54.699Z","dependency_job_id":null,"html_url":"https://github.com/railsware/db_structure_ext","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fdb_structure_ext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fdb_structure_ext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fdb_structure_ext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/railsware%2Fdb_structure_ext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/railsware","download_url":"https://codeload.github.com/railsware/db_structure_ext/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250337947,"owners_count":21414104,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T19:10:43.756Z","updated_at":"2025-04-22T23:08:40.667Z","avatar_url":"https://github.com/railsware.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DbStructureExt\n\nActiveRecord connection adapter extensions.\n\nCurrently it extends only mysql/mysql2 adapter with structure_dump/structure_load methods.\n\nLibrary **does not override** mysql adapter by default.\n\nSo you can use extensions independently (via MysqlConnectionProxy) or include extension methods into adapter.\n\n## Goals\n\n* dump/load __full__ mysql structure (with tables/views/triggers/routines)\n* dump/load mysql structure from any database/file to any file/database\n* parallel_tests support in mysql structures\n\n## Installation\n\n    gem install db_structure_ext\n\n## Using MysqlConnectionProxy\n\n    connection = ActiveRecord::Base.connection\n    connection_proxy = DbStructureExt::MysqlConnectionProxy.new(connection)\n    connection_proxy.structure_dump\n\n## Extending mysql adapter\n\n    require 'db_structure_ext/init_mysql_adapter'\n    connection.structure_dump\n\nIt automaticaly detects corresponding mysql/mysq2 adapter.\nSo it should works with any rails version including v1.2.6\n\n## Dump structure\n\nExtended *structure_dump* for mysql/mysql2 adapter dumps not only *tables*. It dumps:\n\n* tables\n* views\n* triggers\n* routines (functions and procedures)\n\n## Load structure\n\nMethod loads sql statements separated by *\\n\\n*\n\n### parallel tests support\n\nIt supports [parallel_tests](https://github.com/grosser/parallel_tests) or another gems that use TEST_ENV_NUMBER variable for tests parallelization.\n\nIt prepends\n\n    ENV['TEST_ENV_NUMBER']\n\nto any table name with *_test* suffix in name\n\n## Rails db tasks extensions\n\nAdd to your *Rakefile*\n\n    require 'db_structure_ext/tasks'\n\nIn case Rails3 it loads tasks automaticaly via railtie mechanizm.\n\n### db:structure:dump\n\nSynopsis:\n\n    rake db:structure:dump[env,file]  # Dump the database structure to a SQL file\n\nBy default it works as original well-known rails task.\nIt dumps development structure to *db/development_structure.sql*\nBut it dumps to NOT only TABLES. It dumps also VIEWS, TRIGGERS and ROUTINES.\n\nAdditionally you can indicate another *environment* as first argument and optionally another dump *file* as second.\nBy default dump filename is *db/{env}_structure.sql*\n\n### db:structure:load\n\nSynopsis:\n\n    rake db:structure:load[env,file]  # Load SQL structure file to the database\n\nIt's opposite task to *db:structure:load* that allows to load db structure from specified file to specified db environment.\nThe arguments is the same as for previous task.\n\n\n### Examples\n\nDump *development* structure to db/development_structure.sql file:\n\n    rake db:structure:dump[development,db/development_structure.sql]\n    # or\n    rake db:structure:dump[development]\n    # or\n    RAILS_ENV=development db:structure:dump\n    # or just\n    rake db:structure:dump\n\nDump development structure to db/my_structure.sql file:\n\n    rake db:structure:dump[development,db/my_structure.sql]\n\nLoad db/my_structure.sql to test database:\n\n    rake db:structure:load[test,db/my_structure.sql]\n\nLoad db/development_structure.sql to development database:\n\n    rake db:structure:load[development,db/development_structure.sql]\n    # or\n    rake db:structure:load[development]\n    # or\n    RAILS_ENV=development rake db:structure:load[development]\n    # or\n    rake db:structure:load\n\n\n## Testing\n\nWe have tested library against AR 1.x.x and AR 3.0.x.\n\nWe use [multiversion](https://github.com/railsware/multiversion) gem\n\nIt assumes you use RVM and Bundler.\n\n### Create rvm aliases\n\n    rvm alias create ar01_r186 ruby-1.8.6-pYOUR_PATCH_LEVEL\n    rvm alias create ar30_r192 ruby-1.9.2-pYOUR_PATCH_LEVEL\n\n### Install multiversion\n\n    gem install multiversion\n\n### Install gems\n\n    multiversion all bundle install\n\n### Run tests\n\n    multiversion all rspec spec\n\n## License\n\n* Copyright (c) 2012 Railsware (www.railsware.com)\n* [MIT](www.opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frailsware%2Fdb_structure_ext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frailsware%2Fdb_structure_ext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frailsware%2Fdb_structure_ext/lists"}