Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Quick hack to setup the database for docker-registry thats not a sqlite bla blah
import sqlalchemy
import sqlalchemy.exc
import sqlalchemy.ext.declarative
import sqlalchemy.orm
import sqlalchemy.sql.functions
from sqlalchemy import create_engine
engine = create_engine('postgresql://user:pass@my.host.post/db_name')
Base = sqlalchemy.ext.declarative.declarative_base(bind=engine)
class Version (Base):
"Schema version for the search-index database"
__tablename__ = 'version'
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
def __repr__(self):
return '<{0}(id={1})>'.format(type(self).__name__, self.id)
class Repository (Base):
"Repository description"
__tablename__ = 'repository'
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True)
name = sqlalchemy.Column(
sqlalchemy.String, nullable=False, unique=True)
description = sqlalchemy.Column(sqlalchemy.String)
def __repr__(self):
return "<{0}(name='{1}', description='{2}')>".format(
type(self).__name__, self.name, self.description)
Base.metadata.create_all()
@zircote

This comment has been minimized.

Copy link
Owner Author

zircote commented Sep 8, 2014

python docker-regsitry-migrate.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.