-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
set up email, database credentials and add documentation in readme
- Loading branch information
1 parent
afa7716
commit 46b9da4
Showing
6 changed files
with
184 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
alembic/versions/da30e7c419f2_auto_generated_db_tables.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
"""auto generated db tables | ||
Revision ID: da30e7c419f2 | ||
Revises: | ||
Create Date: 2024-11-04 23:45:59.654459 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = 'da30e7c419f2' | ||
down_revision: Union[str, None] = None | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('registration_requests', | ||
sa.Column('user_id', sa.Integer(), autoincrement=True, nullable=False), | ||
sa.Column('user_name', sa.String(length=150), nullable=False), | ||
sa.Column('email', sa.String(length=255), nullable=False), | ||
sa.Column('password', sa.String(length=100), nullable=False), | ||
sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False), | ||
sa.PrimaryKeyConstraint('user_id'), | ||
sa.UniqueConstraint('user_id') | ||
) | ||
op.create_index(op.f('ix_registration_requests_email'), 'registration_requests', ['email'], unique=True) | ||
op.create_table('roles', | ||
sa.Column('role_id', sa.Integer(), autoincrement=True, nullable=False), | ||
sa.Column('role_name', sa.String(length=50), nullable=False), | ||
sa.PrimaryKeyConstraint('role_id'), | ||
sa.UniqueConstraint('role_id'), | ||
sa.UniqueConstraint('role_name') | ||
) | ||
op.create_table('users', | ||
sa.Column('user_id', sa.Integer(), autoincrement=True, nullable=False), | ||
sa.Column('user_name', sa.String(length=150), nullable=False), | ||
sa.Column('email', sa.String(length=255), nullable=False), | ||
sa.Column('password', sa.String(length=100), nullable=False), | ||
sa.Column('status', sa.String(), server_default=sa.text("'active'"), nullable=False), | ||
sa.Column('verified_at', sa.TIMESTAMP(timezone=True), nullable=True), | ||
sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False), | ||
sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False), | ||
sa.PrimaryKeyConstraint('user_id'), | ||
sa.UniqueConstraint('user_id') | ||
) | ||
op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True) | ||
op.create_table('codes', | ||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), | ||
sa.Column('user_id', sa.Integer(), nullable=False), | ||
sa.Column('code', sa.String(), nullable=False), | ||
sa.Column('expires_at', sa.TIMESTAMP(timezone=True), nullable=False), | ||
sa.ForeignKeyConstraint(['user_id'], ['users.user_id'], ondelete='CASCADE'), | ||
sa.PrimaryKeyConstraint('id'), | ||
sa.UniqueConstraint('id') | ||
) | ||
op.create_index(op.f('ix_codes_code'), 'codes', ['code'], unique=False) | ||
op.create_index(op.f('ix_codes_user_id'), 'codes', ['user_id'], unique=False) | ||
op.create_table('user_roles', | ||
sa.Column('user_id', sa.Integer(), nullable=True), | ||
sa.Column('role_id', sa.Integer(), nullable=True), | ||
sa.ForeignKeyConstraint(['role_id'], ['roles.role_id'], ondelete='CASCADE'), | ||
sa.ForeignKeyConstraint(['user_id'], ['users.user_id'], ondelete='CASCADE') | ||
) | ||
op.create_table('user_tokens', | ||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), | ||
sa.Column('user_id', sa.Integer(), nullable=False), | ||
sa.Column('access_key', sa.String(length=250), nullable=False), | ||
sa.Column('refresh_key', sa.String(length=250), nullable=False), | ||
sa.Column('device_id', sa.String(), nullable=False), | ||
sa.Column('device_name', sa.String(), server_default=sa.text("'NONAME'"), nullable=False), | ||
sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False), | ||
sa.Column('last_used_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('now()'), nullable=False), | ||
sa.Column('expires_at', sa.TIMESTAMP(timezone=True), nullable=False), | ||
sa.ForeignKeyConstraint(['user_id'], ['users.user_id'], ondelete='CASCADE'), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
op.create_index(op.f('ix_user_tokens_access_key'), 'user_tokens', ['access_key'], unique=False) | ||
op.create_index(op.f('ix_user_tokens_device_id'), 'user_tokens', ['device_id'], unique=False) | ||
op.create_index(op.f('ix_user_tokens_refresh_key'), 'user_tokens', ['refresh_key'], unique=False) | ||
op.create_index(op.f('ix_user_tokens_user_id'), 'user_tokens', ['user_id'], unique=False) | ||
op.create_table('verification_codes', | ||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), | ||
sa.Column('user_id', sa.Integer(), nullable=False), | ||
sa.Column('code', sa.String(), nullable=False), | ||
sa.Column('expires_at', sa.TIMESTAMP(timezone=True), nullable=False), | ||
sa.ForeignKeyConstraint(['user_id'], ['users.user_id'], ondelete='CASCADE'), | ||
sa.PrimaryKeyConstraint('id'), | ||
sa.UniqueConstraint('id') | ||
) | ||
op.create_index(op.f('ix_verification_codes_code'), 'verification_codes', ['code'], unique=False) | ||
op.create_index(op.f('ix_verification_codes_user_id'), 'verification_codes', ['user_id'], unique=False) | ||
op.create_table('verification_codes_opt', | ||
sa.Column('id', sa.Integer(), autoincrement=True, nullable=False), | ||
sa.Column('user_id', sa.Integer(), nullable=False), | ||
sa.Column('code', sa.String(), nullable=False), | ||
sa.Column('expires_at', sa.TIMESTAMP(timezone=True), nullable=False), | ||
sa.ForeignKeyConstraint(['user_id'], ['registration_requests.user_id'], ondelete='CASCADE'), | ||
sa.PrimaryKeyConstraint('id'), | ||
sa.UniqueConstraint('id') | ||
) | ||
op.create_index(op.f('ix_verification_codes_opt_code'), 'verification_codes_opt', ['code'], unique=False) | ||
op.create_index(op.f('ix_verification_codes_opt_user_id'), 'verification_codes_opt', ['user_id'], unique=False) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index(op.f('ix_verification_codes_opt_user_id'), table_name='verification_codes_opt') | ||
op.drop_index(op.f('ix_verification_codes_opt_code'), table_name='verification_codes_opt') | ||
op.drop_table('verification_codes_opt') | ||
op.drop_index(op.f('ix_verification_codes_user_id'), table_name='verification_codes') | ||
op.drop_index(op.f('ix_verification_codes_code'), table_name='verification_codes') | ||
op.drop_table('verification_codes') | ||
op.drop_index(op.f('ix_user_tokens_user_id'), table_name='user_tokens') | ||
op.drop_index(op.f('ix_user_tokens_refresh_key'), table_name='user_tokens') | ||
op.drop_index(op.f('ix_user_tokens_device_id'), table_name='user_tokens') | ||
op.drop_index(op.f('ix_user_tokens_access_key'), table_name='user_tokens') | ||
op.drop_table('user_tokens') | ||
op.drop_table('user_roles') | ||
op.drop_index(op.f('ix_codes_user_id'), table_name='codes') | ||
op.drop_index(op.f('ix_codes_code'), table_name='codes') | ||
op.drop_table('codes') | ||
op.drop_index(op.f('ix_users_email'), table_name='users') | ||
op.drop_table('users') | ||
op.drop_table('roles') | ||
op.drop_index(op.f('ix_registration_requests_email'), table_name='registration_requests') | ||
op.drop_table('registration_requests') | ||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
MAIL_USERNAME=REPLACE_THIS_WITH_YOUR_EMAIL_ADDRESS_@GMAIL.COM | ||
MAIL_PASSWORD=REPLACE_THIS_WITH_YOUR_EMAIL_PASSWORD | ||
MAIL_PORT=EMAIL_PORT | ||
MAIL_SERVER=YOUR_EMAIL_SERVER | ||
# Warning: PLEASE USE THESE CREDENTIALS FOR DEVELOPMENT PURPOSES ONLY | ||
MAIL_USERNAME=open.source.user.authentication@gmail.com | ||
MAIL_PASSWORD=avvx yapu kbko nbzg | ||
MAIL_PORT=587 | ||
MAIL_SERVER=smtp.gmail.com | ||
MAIL_STARTTLS=True | ||
MAIL_SSL_TLS=False | ||
MAIL_DEBUG=True | ||
MAIL_FROM=REPLACE_THIS_WITH_YOUR_EMAIL_ADDRESS_@GMAIL.COM | ||
MAIL_FROM_NAME=APP_NAME | ||
MAIL_FROM=open.source.user.authentication@gmail.com | ||
MAIL_FROM_NAME=fastapi-user-authentication | ||
USE_CREDENTIALS=True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.