Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
60 lines (43 sloc) 1.59 KB
# -*- coding: utf-8 -*-
This module contains the database mdoels of SpringCreek.
from flask import url_for
from flaskext.sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class BaseModel(object):
def save(self):
return db.session.commit()
class BuildRequest(db.Model, BaseModel):
id = db.Column(db.Integer, primary_key=True)
buildpack_url = db.Column(db.String(300), unique=False)
application_url = db.Column(db.String(300), unique=False)
keep = db.Column(db.Boolean)
def __repr__(self):
return '<BuildRequest %r>' %
def results(self):
return BuildResult.query.filter_by(request=self).all()
def __init__(self, buildpack_url, application_url, keep=False):
self.buildpack_url = buildpack_url
self.application_url = application_url
self.keep = keep
def url(self):
return url_for('view_build',
class BuildResult(db.Model, BaseModel):
id = db.Column(db.Integer, primary_key=True)
request_id = db.ForeignKey('')
heroku_app = db.Column(db.String(50), unique=False)
install_log = db.Column(db.Text(), unique=False, nullable=True)
runtime_log = db.Column(db.Text(), unique=False, nullable=True)
success = db.Column(db.Boolean, nullable=True)
active = db.Column(db.Boolean, nullable=True)
def __repr__(self):
return '<BuildResult %r>' %
def heroku_url(self):
return 'http://{self.heroku_app}'.format(self=self)