radiocosmology / alpenhorn

Alpenhorn is a service for managing an archive of scientific data.
MIT License
2 stars 1 forks source link

Use schema migrations #54

Open cubranic opened 6 years ago

cubranic commented 6 years ago

Docs: http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#schema-migrations

ketiltrout commented 6 years ago

Is there no way to make new tables?

cubranic commented 6 years ago

I suppose it's part of the core Database/Model API (http://docs.peewee-orm.com/en/latest/peewee/models.html#creating-model-tables):

# Connect to our database.
db.connect()

# Create the tables.
db.create_tables([User, Tweet])

It would be nice to be versioned, though. Maybe we should get some clarification from Peewee's author?

ketiltrout commented 6 years ago

Ah, so the schema-migration module just provides the SQL metadata-altering statements not in base peewee. That makes sense.

My reading of the playhouse docs is that schema versioning is left to the user, which I think is fine.

cubranic commented 6 years ago

And there is this third-party project to provide a "real" migrations framework for Peewee: https://github.com/klen/peewee_migrate