Skip to main content

Diffs your models against your database, and outputs SQL to (non-destructively) update your schema.

Think of it as db.create_tables() on steriods (which doesn’t drop your database).

You can also think of it as schema migrations, without having to actually write the migrations.

Quick Start

  1. Run: sudo pip install peewee-db-evolve

  2. Add import peeweedbevolve anywhere before your models are defined.

  3. Run db.evolve() where you would have normally run db.create_tables(), and enjoy!

Example

See our Hello World example.

image

image

Supported Databases

  • PostgreSQL

  • MySQL

Frequently Asked Questions

Does this work with existing projects, or only with new projects?

This works very well with existing projects. If your API only works with new projects, you’re probably doing it wrong.

Don’t you give up control by not writing your own migrations?

Managing your schema by writing your own migrations is kind of like managing your source code by writing your own patch files in addition to writing your actual code. A well vetted diff tool is going to be better and faster at it than you.

How old / well vetted is this tool?

This project has been in production use since August 2016. (We switched to Peewee as an ORM.) But it’s a style of schema management I’ve been using for ~10 years now.

How can I prevent ``peewee-db-evolve`` from evolving a specific table or class?

In the class’ Meta class, add evolve = False and peewee-db-evolve will ignore it. If you don’t have a class for a specific table, just make a do-nothing dummy class for it.

Tests

How to run:

$ python3 test.py
..................................................................................................
----------------------------------------------------------------------
Ran 98 tests in 39.860s

OK

Metadata

Release files for peewee-db-evolve 3.7.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for peewee-db-evolve 3.7.6
File Size Uploaded
peewee-db-evolve-3.7.6.tar.gz 11.5 kB Details

Release files / peewee-db-evolve-3.7.6.tar.gz

Download URL peewee-db-evolve-3.7.6.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b279fc1d317de9f9d204ab85758415bcf1d437515d583d48caaea55346b2271f
BLAKE2b-256 checksum
How to use checksums
43b75e75c8fb646ce19c0f80658252a4eccb58c24fa3b5ca7b386cf6fe5b3f39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7

Release history Release notifications | RSS feed

This release

3.7.6 This release

1 release file

3.7.5

1 release file

3.7.4

1 release file

3.7.3

1 release file

3.7.2

1 release file

3.7.1

1 release file

3.7.0

1 release file

0.6.8

1 release file

0.6.7

1 release file

0.6.6

1 release file

0.6.4

1 release file

0.6.3

1 release file

0.6.2

1 release file

0.6.1

1 release file

0.6.0

1 release file

0.5.3

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.9

1 release file

0.4.8

1 release file

0.4.7

1 release file

0.4.6

1 release file

0.4.5

1 release file

0.4.4

1 release file

0.4.3

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.0

1 release file

0.2.1

1 release file

0.2.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page