Skip to content
Browse files

Create schema

  • Loading branch information...
1 parent c3e5ae4 commit bd4adab5af9a999477e1c78b2908386fc764b2b5 @baijum committed Jan 25, 2011
Showing with 23 additions and 1 deletion.
  1. +2 −0 create_tables.py
  2. +1 −1 py3k/config.py
  3. +20 −0 py3k/model.py
View
2 create_tables.py
@@ -0,0 +1,2 @@
+from py3k.application import db
+db.create_all()
View
2 py3k/config.py
@@ -9,7 +9,7 @@
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
-
+#
# THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
# FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
View
20 py3k/model.py
@@ -2,6 +2,16 @@
from werkzeug import generate_password_hash, check_password_hash
+
+class Distribution(db.Model):
+ __tablename__ = 'distribution'
+ id = db.Column(db.Integer, primary_key=True)
+ name = db.Column(db.String(50), unique=True)
+ url = db.Column(db.String(50), unique=True)
+ authors = db.Column(db.String(50), unique=True)
+ summary = db.Column(db.String(50), unique=True)
+
+
class User(db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True)
@@ -28,3 +38,13 @@ def check_password(self, password):
def __repr__(self):
return '<User %r>' % (self.username)
+
+
+class Comments(db.Model):
+ __tablename__ = 'comments'
+ id = db.Column(db.Integer, primary_key=True)
+ distribution_id = db.Column("distribution_id", db.Integer, db.ForeignKey('distribution.id'))
+ user_id = db.Column("user_id", db.Integer, db.ForeignKey('users.id'))
+ comment = db.Column(db.String(5000))
+ status = db.Column(db.Boolean()) #True=Working,False=FAILING
+

0 comments on commit bd4adab

Please sign in to comment.
Something went wrong with that request. Please try again.