https://github.com/percolate/ddldump
Dump a clean version of the DDLs of your tables, so you can version them.
https://github.com/percolate/ddldump
Last synced: 11 months ago
JSON representation
Dump a clean version of the DDLs of your tables, so you can version them.
- Host: GitHub
- URL: https://github.com/percolate/ddldump
- Owner: percolate
- License: gpl-3.0
- Created: 2016-08-16T22:47:51.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-03-16T17:16:30.000Z (over 3 years ago)
- Last Synced: 2025-07-23T22:34:01.813Z (about 1 year ago)
- Language: Python
- Homepage:
- Size: 117 KB
- Stars: 29
- Watchers: 31
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# ddldump
[](https://circleci.com/gh/percolate/ddldump)
Dump and version the DDLs of your tables, while cleaning the dumps of all the
varying stuff, like MySQL's AUTOINCs, that would make it hard to version and
check for differences during continuous integration.
## Usage
```bash
ddldump [table] > table.sql
```
## Example
Dump all the table DDLs of the MySQL database `cooldb`:
```
ddldump mysql://localhost/cooldb > cooldb.sql
```
Dump the specific DDL of the `awesome` PostgreSQL table.
(requires `postgresql-client`, matching the server version, to be installed):
```bash
ddldump postgresql://localhost/mydb awesome > awesome.sql
```
Compare your dump with what's actually in your database:
```bash
$ ddldump --diff=cooldb.sql mysql://localhost/cooldb
--- mysql
+++ cooldb.sql
@@ -14,7 +14,7 @@
-- Create syntax for TABLE 'user'
CREATE TABLE `user` (
- `id` bigint(20) unsigned COMMENT 'The user ID',
+ `id` bigint(20) unsigned NOT NULL COMMENT 'The user ID',
`name` varchar(64) NOT NULL COMMENT 'The user name',
PRIMARY KEY (`id`)
```
## Install
```bash
pip install ddldump
```
## Upload a new version
1. Set a new version in `ddldump/constants.py`
1. Open a PR, get it reviewed, get it merged
1. `git tag `
1. `git push --tags`
1. `make release`