phone and username not unique anymore
This commit is contained in:
parent
5520fe0204
commit
6c28df7617
|
@ -12,8 +12,8 @@ class User(db.Model):
|
||||||
first_name: Mapped[str] = mapped_column(nullable=True)
|
first_name: Mapped[str] = mapped_column(nullable=True)
|
||||||
last_name: Mapped[str] = mapped_column(nullable=True)
|
last_name: Mapped[str] = mapped_column(nullable=True)
|
||||||
|
|
||||||
phone: Mapped[str] = mapped_column(nullable=True, unique=True)
|
phone: Mapped[str] = mapped_column(nullable=True)
|
||||||
username: Mapped[str] = mapped_column(nullable=True, unique=True)
|
username: Mapped[str] = mapped_column(nullable=True)
|
||||||
|
|
||||||
collection_id = Column(Integer, ForeignKey("collection.id"))
|
collection_id = Column(Integer, ForeignKey("collection.id"))
|
||||||
collection: Mapped["Collection"] = relationship("Collection", back_populates="users")
|
collection: Mapped["Collection"] = relationship("Collection", back_populates="users")
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
"""phone and username not unique
|
||||||
|
|
||||||
|
Revision ID: 11ed77b4dbe8
|
||||||
|
Revises: d573f6529ad5
|
||||||
|
Create Date: 2024-03-09 22:59:14.088171
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '11ed77b4dbe8'
|
||||||
|
down_revision = 'd573f6529ad5'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||||
|
batch_op.drop_constraint('user_phone_key', type_='unique')
|
||||||
|
batch_op.drop_constraint('user_username_key', type_='unique')
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table('user', schema=None) as batch_op:
|
||||||
|
batch_op.create_unique_constraint('user_username_key', ['username'])
|
||||||
|
batch_op.create_unique_constraint('user_phone_key', ['phone'])
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
Loading…
Reference in New Issue