Skip to content

Document use of fastmigrate with fastlite #6

Description

@pydanny

Something like this:

from fastlite import *
from fastmigrate import *

def get_db():


    # Determine db path
    if IN_NOTEBOOK or os.getenv("IN_TEST"): 
        dbpath = datapath/'dev_data.db'
        for o in '','-shm','-wal': (datapath/f'dev_data.db{o}').unlink(missing_ok=True)
    else: dbpath = datapath/'data.db'

    migrations_dir = '??'

    # fastmigrate: Ensure the db is versioned
    ensure_versioned_db(dbpath)
    # fastmigrate: run migrations
    run_migrations(dbpath, migrations_dir)
    # fastlight: instantiate db path
    db = database(dbpath)
    return db

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions