Skip to main content

No project description provided

Project description

database_schema_ensurer

Ensures that the database schema is at a certain version.

Usage

Put your migrations in a directory. Each migration SQL file name must obey these rules:

  • Start with {version}_ (e.g. 1_init.sql.up)
  • Have two versions: .up.sql for upgrading (adding the necessary things) and .down.sql for downgrading (undoing the upgrade) (must have the specified extensions)
from database_schema_ensurer import migrate, Database

class MyDatabase(Database):
    ...
    # Implement all the methods or use a library:
    # * Postgres: postgres_schema_ensurer

migrate(
    MyDatabase(...),
    target_version=OPTIONAL_SPECIFIC_VERSION, # Default: greatest version from the directory
    migrations_directory=OPTIONAL_SPECIFIC_DIRECTORY, # Default: "migrations"
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

database_schema_ensurer-2.0.0.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

database_schema_ensurer-2.0.0-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file database_schema_ensurer-2.0.0.tar.gz.

File metadata

  • Download URL: database_schema_ensurer-2.0.0.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.8.0-35-generic

File hashes

Hashes for database_schema_ensurer-2.0.0.tar.gz
Algorithm Hash digest
SHA256 1dc33553c3e41f999f055946c7c6c01cdb8c318d284c04ab9db84e67fefb185f
MD5 beac05e11add32b612e3cfdd5f62af12
BLAKE2b-256 8aae779aee4c68af77e5524ee5b8b0878026c6c172aac17d1bd18057a829c46e

See more details on using hashes here.

File details

Details for the file database_schema_ensurer-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for database_schema_ensurer-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b24bb08187d837c6cb7a22d6649a39f8d9871f64b678065964ff66f26ccd2d1
MD5 d43b6227309029030d3037528fe25bf3
BLAKE2b-256 de895b451da754c1c081f2997d2b610bcf965c912d497c318ff1309fb7e440af

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page