-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from hngprojects/Muritadhor
Updated the database models with new tables
- Loading branch information
Showing
22 changed files
with
498 additions
and
182 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
PYTHON_ENV=dev | ||
DB_TYPE=postgresql | ||
DB_NAME=dbname | ||
DB_USER=user | ||
DB_PASSWORD=password | ||
DB_HOST=127.0.0.1 | ||
DB_NAME="" | ||
DB_USER="" | ||
DB_PASSWORD="" | ||
DB_HOST="" | ||
DB_PORT=5432 | ||
MYSQL_DRIVER=pymysql | ||
DB_URL="postgresql://user:password@127.0.0.1:5432/dbname" | ||
MYSQL_DRIVER= | ||
DB_URL=postgresql://username:password@host:PORT/dbname | ||
SECRET_KEY = "" | ||
ALGORITHM = HS256 | ||
ACCESS_TOKEN_EXPIRE_MINUTES = 10 | ||
JWT_REFRESH_EXPIRY=5 | ||
APP_URL= | ||
APP_URL= |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"""added blogs table | ||
Revision ID: 05f17b6961cc | ||
Revises: 43c2111ee2c0 | ||
Create Date: 2024-07-19 23:25:19.980417 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = '05f17b6961cc' | ||
down_revision: Union[str, None] = '43c2111ee2c0' | ||
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('blogs', | ||
sa.Column('id', sa.UUID(), nullable=False), | ||
sa.Column('author_id', sa.UUID(), nullable=False), | ||
sa.Column('title', sa.String(length=100), nullable=False), | ||
sa.Column('content', sa.Text(), nullable=True), | ||
sa.Column('image_url', sa.String(length=100), nullable=True), | ||
sa.Column('tags', postgresql.ARRAY(sa.String(length=20)), nullable=True), | ||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True), | ||
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True), | ||
sa.ForeignKeyConstraint(['author_id'], ['users.id'], ), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table('blogs') | ||
# ### 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"""added jobs table | ||
Revision ID: 17be96741cf5 | ||
Revises: c22e5c00f9c9 | ||
Create Date: 2024-07-20 00:52:49.465976 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = '17be96741cf5' | ||
down_revision: Union[str, None] = 'c22e5c00f9c9' | ||
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('jobs', | ||
sa.Column('id', sa.UUID(), nullable=False), | ||
sa.Column('user_id', sa.UUID(), nullable=False), | ||
sa.Column('title', sa.String(length=255), nullable=False), | ||
sa.Column('description', sa.Text(), nullable=False), | ||
sa.Column('location', sa.String(length=255), nullable=True), | ||
sa.Column('salary', sa.Numeric(precision=10, scale=2), nullable=True), | ||
sa.Column('job_type', sa.String(length=50), nullable=True), | ||
sa.Column('company_name', sa.String(length=255), nullable=True), | ||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True), | ||
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True), | ||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table('jobs') | ||
# ### 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"""added subscription table | ||
Revision ID: 43c2111ee2c0 | ||
Revises: 61f79886b26a | ||
Create Date: 2024-07-19 23:01:29.197196 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = '43c2111ee2c0' | ||
down_revision: Union[str, None] = '61f79886b26a' | ||
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('subscriptions', | ||
sa.Column('id', sa.UUID(), nullable=False), | ||
sa.Column('user_id', sa.UUID(), nullable=False), | ||
sa.Column('plan', sa.String(length=50), nullable=False), | ||
sa.Column('is_active', sa.Boolean(), nullable=True), | ||
sa.Column('start_date', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True), | ||
sa.Column('end_date', sa.DateTime(timezone=True), nullable=True), | ||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True), | ||
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True), | ||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), | ||
sa.PrimaryKeyConstraint('id') | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table('subscriptions') | ||
# ### 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
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
alembic/versions/c22e5c00f9c9_added_waitlist_users_table.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,38 @@ | ||
"""added waitlist users table | ||
Revision ID: c22e5c00f9c9 | ||
Revises: 05f17b6961cc | ||
Create Date: 2024-07-19 23:40:34.169213 | ||
""" | ||
from typing import Sequence, Union | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = 'c22e5c00f9c9' | ||
down_revision: Union[str, None] = '05f17b6961cc' | ||
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('waitlist_users', | ||
sa.Column('id', sa.UUID(), nullable=False), | ||
sa.Column('email', sa.String(length=100), nullable=False), | ||
sa.Column('full_name', sa.String(length=100), nullable=False), | ||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True), | ||
sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True), | ||
sa.PrimaryKeyConstraint('id'), | ||
sa.UniqueConstraint('email') | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table('waitlist_users') | ||
# ### end Alembic commands ### |
Oops, something went wrong.