paver create_db was throwing errors about files table missing for foreign key

1 view
Skip to first unread message

TMaYaD

unread,
Feb 20, 2009, 6:54:40 PM2/20/09
to Bespin
Hi,
I have tried to deploy bespin on my home server and got the an error
about files table missing and then when I fixed it about FileStatus.

Here is a Hg patch for it.

# HG changeset patch
# User TMaYaD <TMa...@LoonyB.in>
# Date 1235173837 0
# Node ID 9fb1ccd1bf5417f6e592aabbe720f5deb3a12592
# Parent 39bcf2703fdbaaa0380e9f09f63f10714b105104
Made a couple of changes to model to sort out dependencies
paver create_db was throwing errors otherwise.

diff -r 39bcf2703fdb -r 9fb1ccd1bf54 backend/python/bespin/model.py
--- a/backend/python/bespin/model.py Fri Feb 20 15:27:38 2009 -0500
+++ b/backend/python/bespin/model.py Fri Feb 20 23:50:37 2009 +0000
@@ -143,14 +143,6 @@
found."""
return self.session.query(User).filter_by
(username=username).first()

-class FileStatus(Base):
- __tablename__ = "filestatus"
-
- user_id = Column(Integer, ForeignKey('users.id',
ondelete='cascade'), primary_key=True)
- file_id = Column(Integer, ForeignKey('files.id',
ondelete='cascade'), primary_key=True)
- read_only = Column(Boolean)
- user = relation(User, backref="files")
-
class File(Base):
__tablename__ = "files"

@@ -166,7 +158,7 @@
dir_id = Column(Integer, ForeignKey('directories.id',
ondelete='cascade'))
dir = relation('Directory', backref="files")

- users = relation(FileStatus,
+ users = relation('FileStatus',
backref="file")

__table_args__ = (UniqueConstraint("project_id", "name"), {})
@@ -194,6 +186,14 @@
project_members = Table('members', Base.metadata,
Column('project_id', Integer, ForeignKey
('projects.id', ondelete='cascade')),
Column('user_id', Integer, ForeignKey
('users.id', ondelete='cascade')))
+
+class FileStatus(Base):
+ __tablename__ = "filestatus"
+
+ user_id = Column(Integer, ForeignKey('users.id',
ondelete='cascade'), primary_key=True)
+ file_id = Column(Integer, ForeignKey('files.id',
ondelete='cascade'), primary_key=True)
+ read_only = Column(Boolean)
+ user = relation(User, backref="files")

class Directory(Base):
__tablename__ = "directories"

Kevin Dangoor

unread,
Feb 25, 2009, 12:25:31 PM2/25/09
to bes...@googlegroups.com
Hi,

On Fri, Feb 20, 2009 at 6:54 PM, TMaYaD <Mr.Su...@gmail.com> wrote:
> I have tried to deploy bespin on my home server and got the an error
> about files table missing and then when I fixed it about FileStatus.

Are you using the sqlite database? I have run create_db without incident...

Kevin


--
Kevin Dangoor

work: http://labs.mozilla.com/
email: k...@blazingthings.com
blog: http://www.BlueSkyOnMars.com

Reply all
Reply to author
Forward
0 new messages