Skip to content

Instantly share code, notes, and snippets.

@zircote
Created September 8, 2014 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zircote/91bb5699bec824b7cc6b to your computer and use it in GitHub Desktop.
Save zircote/91bb5699bec824b7cc6b to your computer and use it in GitHub Desktop.
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
Copy link
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