88from alembic import op
99import sqlalchemy as sa
1010
11-
1211# revision identifiers, used by Alembic.
1312revision = 'd11062fbec93'
1413down_revision = '4594cf7d8bfb'
1918def upgrade ():
2019 # ### commands auto generated by Alembic - please adjust! ###
2120 op .create_table ('owners' ,
22- sa .Column ('id' , sa .BigInteger ().with_variant (sa .Integer (), 'sqlite' ), nullable = False ),
23- sa .Column ('client_id' , sa .String (length = 255 ), nullable = False ),
24- sa .Column ('name' , sa .String (length = 255 ), nullable = False ),
25- sa .PrimaryKeyConstraint ('id' ),
26- sa .UniqueConstraint ('client_id' )
27- )
21+ sa .Column ('id' , sa .BigInteger ().with_variant (sa .Integer (), 'sqlite' ), nullable = False ),
22+ sa .Column ('client_id' , sa .String (length = 255 ), nullable = False ),
23+ sa .Column ('name' , sa .String (length = 255 ), nullable = False ),
24+ sa .PrimaryKeyConstraint ('id' ),
25+ sa .UniqueConstraint ('client_id' )
26+ )
2827 op .add_column ('resources' , sa .Column ('owner_id' , sa .Integer (), nullable = False ))
2928 op .alter_column ('resources' , 'name' ,
30- existing_type = sa .VARCHAR (length = 50 ),
31- nullable = False )
29+ existing_type = sa .VARCHAR (length = 50 ),
30+ nullable = False )
3231 op .create_foreign_key (None , 'resources' , 'owners' , ['owner_id' ], ['id' ])
3332 op .drop_column ('resources' , 'owner' )
3433 # ### end Alembic commands ###
@@ -39,8 +38,8 @@ def downgrade():
3938 op .add_column ('resources' , sa .Column ('owner' , sa .VARCHAR (length = 50 ), autoincrement = False , nullable = True ))
4039 op .drop_constraint (None , 'resources' , type_ = 'foreignkey' )
4140 op .alter_column ('resources' , 'name' ,
42- existing_type = sa .VARCHAR (length = 50 ),
43- nullable = True )
41+ existing_type = sa .VARCHAR (length = 50 ),
42+ nullable = True )
4443 op .drop_column ('resources' , 'owner_id' )
4544 op .drop_table ('owners' )
4645 # ### end Alembic commands ###
0 commit comments