{"id":17882253,"url":"https://github.com/mackee/githubddl","last_synced_at":"2025-10-08T08:51:56.182Z","repository":{"id":56839674,"uuid":"431814891","full_name":"mackee/GitHubDDL","owner":"mackee","description":"GitDDL compatibility database migration utility when  hosted on GitHub","archived":false,"fork":false,"pushed_at":"2021-11-30T04:23:54.000Z","size":23,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T12:52:54.848Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mackee.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","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":"2021-11-25T11:08:43.000Z","updated_at":"2021-12-04T16:27:51.000Z","dependencies_parsed_at":"2022-08-29T05:01:01.489Z","dependency_job_id":null,"html_url":"https://github.com/mackee/GitHubDDL","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackee%2FGitHubDDL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackee%2FGitHubDDL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackee%2FGitHubDDL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackee%2FGitHubDDL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mackee","download_url":"https://codeload.github.com/mackee/GitHubDDL/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246922246,"owners_count":20855345,"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-10-28T12:49:04.426Z","updated_at":"2025-10-08T08:51:51.148Z","avatar_url":"https://github.com/mackee.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nGitHubDDL - GitDDL compatibility database migration utility when  hosted on GitHub\n\n# SYNOPSIS\n\n    use GitHubDDL;\n    my $gd = GitHubDDL-\u003enew(\n        ddl_file     =\u003e 'sql/schema_ddl.sql',\n        dsn          =\u003e ['dbi:mysql:my_project', 'root', ''],\n        ddl_version  =\u003e '...',\n        github_user  =\u003e '\u003cyour GitHub user/org name\u003e',\n        github_repo  =\u003e '\u003cyour GitHub repository name\u003e',\n        github_token =\u003e '\u003cyour GitHub token\u003e',\n    );\n\n    # checking whether the database version matchs ddl_file version or not.\n    $gd-\u003echeck_version;\n\n    # getting database version\n    my $db_version = $gd-\u003edatabase_version;\n\n    # getting ddl version\n    my $ddl_version = $gd-\u003eddl_version;\n\n    # upgrade database\n    $gd-\u003eupgrade_database;\n\n    # deploy ddl\n    $gd-\u003edeploy;\n\n# DESCRIPTION\n\nGitHubDDL is a tool module of the migration for RDBMS uses SQL::Translator::Diff.\n\nThis is database migration helper module for users who manage database schema version by single .sql file in git repository.\n\nBy using this module, you can deploy .sql to database, check sql version between database and .sql file, make diff between them, and apply alter table to database.\n\n# METHODS\n\n## GitHubDDL-\u003enew(%options)\n\n    my $gd = GitHubDDL-\u003enew(\n        ddl_file     =\u003e 'sql/schema_ddl.sql',\n        dsn          =\u003e ['dbi:mysql:my_project', 'root', ''],\n        ddl_version  =\u003e '...',\n        github_user  =\u003e '\u003cyour GitHub user/org name\u003e',\n        github_repo  =\u003e '\u003cyour GitHub repository name\u003e',\n        github_token =\u003e '\u003cyour GitHub token\u003e',\n    );\n\nCreate GitHubDDL object. Available options are:\n\n- ddl\\_file  =\u003e 'Str' (Required)\n\n    ddl file (.sql file) path in repository.\n\n    If ddl file located at /repos/project/sql/schema.sql and work\\_dir root is /repos/project, then this option should be sql/schema.sql\n\n- dsn =\u003e 'ArrayRef' (Required)\n\n    DSN parameter that pass to [DBI](https://metacpan.org/pod/DBI) module.\n\n- ddl\\_version =\u003e 'Str' (Required)\n\n    DDL file's commit hash of local. If you need to apply schema to database by working dir's schema, you specify current commit hash of this file. **THIS IS NOT OLDER COMMIT HASH**.\n\n- github\\_user =\u003e 'Str' (Required)\n\n    GitHub's user or organization name of repository.\n\n- github\\_repo =\u003e 'Str' (Required)\n\n    GitHub's repository name.\n\n- github\\_token =\u003e 'Str' (Required)\n\n    GitHub's Personal Access Token. This is used to retrieve DDL that is applied to the database from GitHub.\n\n    NOTE: If you need to use the authority of GitHub Apps, you can use [GitHub::Apps::Auth](https://metacpan.org/pod/GitHub%3A%3AApps%3A%3AAuth) in it.\n\n- work\\_dir =\u003e 'Str' (Optional)\n\n    Working directory of path includes target ddl file. Default is current working directory.\n\n- version\\_table =\u003e 'Str' (Optional)\n\n    database table name that contains its git commit version. (default: git\\_ddl\\_version)\n\n- sql\\_filter =\u003e 'CodeRef' (Optional)\n\n    CodeRef for filtering sql content. It is invoked only in `diff()` method. (default: do nothing)\n\n- dump\\_sql\\_specified\\_commit\\_method =\u003e 'CodeRef' (Optional)\n\n    CodeRef for a bypass for dump SQL from GitHub. If you need to use your project-specific retrieve SQL method, you should set this option. This option is used as an alternative to the original method. (default: do nothing)\n\n    This CodeRef takes a commit hash as the only argument.\n\n## check\\_version()\n\nCompare versions latest ddl sql and database, and return true when both version is same.\n\nOtherwise return false, which means database is not latest. To upgrade database to latest, see upgrade\\_database method described below.\n\n## database\\_version()\n\nReturn git commit hash indicates database's schema.\n\n## ddl\\_version()\n\nReturn git commit hash indicates ddl file.\n\n## deploy()\n\nJust deploy ddl\\_file schema to database. This method is designed for initial database setup.\nBut database should be created previously.\n\n## diff()\n\nShow sql differences between ddl file and database.\nThis method is useful for dry-run checking before upgrade\\_database.\n\n## upgrade\\_database()\n\nUpgrade database schema to latest ddl schema.\n\n# SEE ALSO\n\n- [GitDDL](https://metacpan.org/pod/GitDDL)\n\n    GitDDL is to compare local a DDL file and an older DDL from history in git.\n    GitHubDDL is almost the same as GitDDL, but the only difference is that it retrieves the old DDL from GitHub.\n\n# LICENSE\n\nCopyright (C) mackee.\n\nThis library is free software; you can redistribute it and/or modify\nit under the same terms as Perl itself.\n\n# AUTHOR\n\nmackee \u003cmacopy123@gmail.com\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmackee%2Fgithubddl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmackee%2Fgithubddl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmackee%2Fgithubddl/lists"}