[copr] bkabrda-workspace: Drop copr.name uniqueness. Don't create more alembic revisions until we actually deploy it somewhere, this makes it easier (17cc75b)

bkabrda at fedorahosted.org bkabrda at fedorahosted.org
Fri Nov 16 12:16:48 UTC 2012


Repository : http://git.fedorahosted.org/cgit/copr.git

On branch  : bkabrda-workspace

>---------------------------------------------------------------

commit 17cc75b29cf309ce8435ae3de9326c3837e4604f
Author: Slavek Kabrda <bkabrda at redhat.com>
Date:   Fri Nov 16 11:40:56 2012 +0100

    Drop copr.name uniqueness. Don't create more alembic revisions until we actually deploy it somewhere, this makes it easier


>---------------------------------------------------------------

 ...b_setup.py => 2cb3b8a9de3a_initial_db_setup.py} |   32 ++++++++++---------
 wsgi/coprs/models.py                               |    2 +-
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/wsgi/alembic/versions/5e4f5077380_initial_db_setup.py b/wsgi/alembic/versions/2cb3b8a9de3a_initial_db_setup.py
similarity index 90%
rename from wsgi/alembic/versions/5e4f5077380_initial_db_setup.py
rename to wsgi/alembic/versions/2cb3b8a9de3a_initial_db_setup.py
index 4b70894..85887db 100644
--- a/wsgi/alembic/versions/5e4f5077380_initial_db_setup.py
+++ b/wsgi/alembic/versions/2cb3b8a9de3a_initial_db_setup.py
@@ -1,13 +1,13 @@
-"""Initial DB setup
+"""Initial db setup
 
-Revision ID: 5e4f5077380
+Revision ID: 2cb3b8a9de3a
 Revises: None
-Create Date: 2012-11-09 08:56:39.836459
+Create Date: 2012-11-16 11:38:30.605131
 
 """
 
 # revision identifiers, used by Alembic.
-revision = '5e4f5077380'
+revision = '2cb3b8a9de3a'
 down_revision = None
 
 from alembic import op
@@ -20,6 +20,7 @@ def upgrade():
     sa.Column('id', sa.Integer(), nullable=False),
     sa.Column('openid_name', sa.String(length=100), nullable=False),
     sa.Column('proven', sa.Boolean(), nullable=True),
+    sa.CheckConstraint('TODO'),
     sa.PrimaryKeyConstraint('id')
     )
     op.create_table('copr',
@@ -29,16 +30,7 @@ def upgrade():
     sa.Column('repos', sa.Text(), nullable=True),
     sa.Column('owner_id', sa.Integer(), nullable=True),
     sa.ForeignKeyConstraint(['owner_id'], ['user.id'], ),
-    sa.PrimaryKeyConstraint('id'),
-    sa.UniqueConstraint('name')
-    )
-    op.create_table('copr_permission',
-    sa.Column('approved', sa.Boolean(), nullable=True),
-    sa.Column('user_id', sa.Integer(), nullable=False),
-    sa.Column('copr_id', sa.Integer(), nullable=False),
-    sa.ForeignKeyConstraint(['copr_id'], ['copr.id'], ),
-    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
-    sa.PrimaryKeyConstraint('user_id', 'copr_id')
+    sa.PrimaryKeyConstraint('id')
     )
     op.create_table('build',
     sa.Column('id', sa.Integer(), nullable=False),
@@ -54,17 +46,27 @@ def upgrade():
     sa.Column('timeout', sa.Integer(), nullable=True),
     sa.Column('user_id', sa.Integer(), nullable=True),
     sa.Column('copr_id', sa.Integer(), nullable=True),
+    sa.CheckConstraint('TODO'),
     sa.ForeignKeyConstraint(['copr_id'], ['copr.id'], ),
     sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
     sa.PrimaryKeyConstraint('id')
     )
+    op.create_table('copr_permission',
+    sa.Column('approved', sa.Boolean(), nullable=True),
+    sa.Column('user_id', sa.Integer(), nullable=False),
+    sa.Column('copr_id', sa.Integer(), nullable=False),
+    sa.CheckConstraint('TODO'),
+    sa.ForeignKeyConstraint(['copr_id'], ['copr.id'], ),
+    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
+    sa.PrimaryKeyConstraint('user_id', 'copr_id')
+    )
     ### end Alembic commands ###
 
 
 def downgrade():
     ### commands auto generated by Alembic - please adjust! ###
-    op.drop_table('build')
     op.drop_table('copr_permission')
+    op.drop_table('build')
     op.drop_table('copr')
     op.drop_table('user')
     ### end Alembic commands ###
diff --git a/wsgi/coprs/models.py b/wsgi/coprs/models.py
index c2a27d8..fa51cc0 100644
--- a/wsgi/coprs/models.py
+++ b/wsgi/coprs/models.py
@@ -85,7 +85,7 @@ class User(db.Model, Serializer):
 
 class Copr(db.Model, Serializer):
     id = db.Column(db.Integer, primary_key = True)
-    name = db.Column(db.String(100), nullable = False, unique = True)
+    name = db.Column(db.String(100), nullable = False)
     chroots = db.Column(db.Text, nullable = False)
     repos = db.Column(db.Text)
 



More information about the copr-devel mailing list