-
Notifications
You must be signed in to change notification settings - Fork 448
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dev: Add initial migration and Running migration instruction to README
Update README update readme apply black fix typo include altering existing column
- Loading branch information
1 parent
d717c93
commit d0acedd
Showing
4 changed files
with
168 additions
and
2 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
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,129 @@ | ||
"""Initial migration | ||
Revision ID: 0541c68e5b13 | ||
Revises: | ||
Create Date: 2021-07-07 12:20:10.523552 | ||
""" | ||
from alembic import op | ||
from app.database.db_types.JsonCustomType import JsonCustomType | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "0541c68e5b13" | ||
down_revision = None | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
"tasks_list", | ||
sa.Column("id", sa.Integer(), nullable=False), | ||
sa.Column("tasks", JsonCustomType, nullable=True), | ||
sa.Column("next_task_id", sa.Integer(), nullable=True), | ||
sa.PrimaryKeyConstraint("id"), | ||
) | ||
op.create_table( | ||
"users", | ||
sa.Column("id", sa.Integer(), nullable=False), | ||
sa.Column("name", sa.String(length=30), nullable=True), | ||
sa.Column("username", sa.String(length=30), nullable=True), | ||
sa.Column("email", sa.String(length=254), nullable=True), | ||
sa.Column("password_hash", sa.String(length=100), nullable=True), | ||
sa.Column("registration_date", sa.Float(), nullable=True), | ||
sa.Column("terms_and_conditions_checked", sa.Boolean(), nullable=True), | ||
sa.Column("is_admin", sa.Boolean(), nullable=True), | ||
sa.Column("is_email_verified", sa.Boolean(), nullable=True), | ||
sa.Column("email_verification_date", sa.DateTime(), nullable=True), | ||
sa.Column("current_mentorship_role", sa.Integer(), nullable=True), | ||
sa.Column("membership_status", sa.Integer(), nullable=True), | ||
sa.Column("bio", sa.String(length=500), nullable=True), | ||
sa.Column("location", sa.String(length=80), nullable=True), | ||
sa.Column("occupation", sa.String(length=80), nullable=True), | ||
sa.Column("organization", sa.String(length=80), nullable=True), | ||
sa.Column("slack_username", sa.String(length=80), nullable=True), | ||
sa.Column("social_media_links", sa.String(length=500), nullable=True), | ||
sa.Column("skills", sa.String(length=500), nullable=True), | ||
sa.Column("interests", sa.String(length=200), nullable=True), | ||
sa.Column("resume_url", sa.String(length=200), nullable=True), | ||
sa.Column("photo_url", sa.String(length=200), nullable=True), | ||
sa.Column("need_mentoring", sa.Boolean(), nullable=True), | ||
sa.Column("available_to_mentor", sa.Boolean(), nullable=True), | ||
sa.PrimaryKeyConstraint("id"), | ||
sa.UniqueConstraint("email"), | ||
sa.UniqueConstraint("username"), | ||
) | ||
op.create_table( | ||
"mentorship_relations", | ||
sa.Column("id", sa.Integer(), nullable=False), | ||
sa.Column("mentor_id", sa.Integer(), nullable=True), | ||
sa.Column("mentee_id", sa.Integer(), nullable=True), | ||
sa.Column("action_user_id", sa.Integer(), nullable=False), | ||
sa.Column("creation_date", sa.Float(), nullable=False), | ||
sa.Column("accept_date", sa.Float(), nullable=True), | ||
sa.Column("start_date", sa.Float(), nullable=True), | ||
sa.Column("end_date", sa.Float(), nullable=True), | ||
sa.Column( | ||
"state", | ||
sa.Enum( | ||
"PENDING", | ||
"ACCEPTED", | ||
"REJECTED", | ||
"CANCELLED", | ||
"COMPLETED", | ||
name="mentorshiprelationstate", | ||
), | ||
nullable=False, | ||
), | ||
sa.Column("notes", sa.String(length=400), nullable=True), | ||
sa.Column("tasks_list_id", sa.Integer(), nullable=True), | ||
sa.ForeignKeyConstraint( | ||
["mentee_id"], | ||
["users.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["mentor_id"], | ||
["users.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["tasks_list_id"], | ||
["tasks_list.id"], | ||
), | ||
sa.PrimaryKeyConstraint("id"), | ||
) | ||
op.create_table( | ||
"tasks_comments", | ||
sa.Column("id", sa.Integer(), nullable=False), | ||
sa.Column("user_id", sa.Integer(), nullable=True), | ||
sa.Column("task_id", sa.Integer(), nullable=True), | ||
sa.Column("relation_id", sa.Integer(), nullable=True), | ||
sa.Column("creation_date", sa.Float(), nullable=False), | ||
sa.Column("modification_date", sa.Float(), nullable=True), | ||
sa.Column("comment", sa.String(length=400), nullable=False), | ||
sa.ForeignKeyConstraint( | ||
["relation_id"], | ||
["mentorship_relations.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["task_id"], | ||
["tasks_list.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["user_id"], | ||
["users.id"], | ||
), | ||
sa.PrimaryKeyConstraint("id"), | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table("tasks_comments") | ||
op.drop_table("mentorship_relations") | ||
op.drop_table("users") | ||
op.drop_table("tasks_list") | ||
# ### 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