Fix starring after rebase.
This commit is contained in:
parent
4f5a78ca2c
commit
97b605ca8d
4 changed files with 41 additions and 39 deletions
|
@ -253,7 +253,7 @@ class Repository(BaseModel):
|
|||
# Therefore, we define our own deletion order here and use the dependency system to verify it.
|
||||
ordered_dependencies = [RepositoryAuthorizedEmail, RepositoryTag, Image, LogEntry,
|
||||
RepositoryBuild, RepositoryBuildTrigger, RepositoryNotification,
|
||||
RepositoryPermission, AccessToken]
|
||||
RepositoryPermission, AccessToken, Star]
|
||||
|
||||
for query, fk in self.dependencies(search_nullable=True):
|
||||
model = fk.model_class
|
||||
|
|
40
data/migrations/versions/2088f2b81010_add_stars.py
Normal file
40
data/migrations/versions/2088f2b81010_add_stars.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
"""add stars
|
||||
|
||||
Revision ID: 2088f2b81010
|
||||
Revises: 1c5b738283a5
|
||||
Create Date: 2014-12-02 17:45:00.707498
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '2088f2b81010'
|
||||
down_revision = '1c5b738283a5'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
def upgrade(tables):
|
||||
op.create_table('star',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('repository_id', sa.Integer(), nullable=False),
|
||||
sa.Column('created', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['repository_id'], ['repository.id'], name=op.f('fk_star_repository_id_repository')),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], name=op.f('fk_star_user_id_user')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_star'))
|
||||
)
|
||||
with op.batch_alter_table('star', schema=None) as batch_op:
|
||||
batch_op.create_index('star_repository_id', ['repository_id'], unique=False)
|
||||
batch_op.create_index('star_user_id', ['user_id'], unique=False)
|
||||
batch_op.create_index('star_user_id_repository_id', ['user_id', 'repository_id'], unique=True)
|
||||
|
||||
def downgrade(tables):
|
||||
op.drop_constraint('fk_star_repository_id_repository', 'star', type_='foreignkey')
|
||||
op.drop_constraint('fk_star_user_id_user', 'star', type_='foreignkey')
|
||||
with op.batch_alter_table('star', schema=None) as batch_op:
|
||||
batch_op.drop_index('star_user_id_repository_id')
|
||||
batch_op.drop_index('star_user_id')
|
||||
batch_op.drop_index('star_repository_id')
|
||||
|
||||
op.drop_table('star')
|
|
@ -1,38 +0,0 @@
|
|||
"""add stars
|
||||
|
||||
Revision ID: 3b668be15dc0
|
||||
Revises: 204abf14783d
|
||||
Create Date: 2014-11-14 14:11:18.687340
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '3b668be15dc0'
|
||||
down_revision = '204abf14783d'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import mysql
|
||||
|
||||
def upgrade(tables):
|
||||
op.create_table('star',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
||||
sa.Column('repository_id', sa.Integer(), nullable=False),
|
||||
sa.Column('created', sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['repository_id'], ['repository.id'], name=op.f('fk_star_repository_id_repository')),
|
||||
sa.ForeignKeyConstraint(['user_id'], ['user.id'], name=op.f('fk_star_user_id_user')),
|
||||
sa.PrimaryKeyConstraint('id', name=op.f('pk_star'))
|
||||
)
|
||||
op.create_index('star_repository_id', 'star', ['repository_id'], unique=False)
|
||||
op.create_index('star_user_id', 'star', ['user_id'], unique=False)
|
||||
op.create_index('star_user_id_repository_id', 'star', ['user_id', 'repository_id'], unique=True)
|
||||
|
||||
|
||||
def downgrade(tables):
|
||||
op.drop_constraint('fk_star_repository_id_repository', 'star', type_='foreignkey')
|
||||
op.drop_constraint('fk_star_user_id_user', 'star', type_='foreignkey')
|
||||
op.drop_index('star_user_id_repository_id', table_name='star')
|
||||
op.drop_index('star_user_id', table_name='star')
|
||||
op.drop_index('star_repository_id', table_name='star')
|
||||
op.drop_table('star')
|
Binary file not shown.
Reference in a new issue