From 154f7512cb788a6020f9be1d81f5bf7372e24595 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Wed, 26 Mar 2025 12:29:54 +0000 Subject: [PATCH] Add migration for Pastor --- .../20250326_122951_f11f9586_create_pastor.py | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 alembic/versions/20250326_122951_f11f9586_create_pastor.py diff --git a/alembic/versions/20250326_122951_f11f9586_create_pastor.py b/alembic/versions/20250326_122951_f11f9586_create_pastor.py new file mode 100644 index 0000000..7316a5d --- /dev/null +++ b/alembic/versions/20250326_122951_f11f9586_create_pastor.py @@ -0,0 +1,42 @@ +"""create pastors table + +Revision ID: b7c8d9e0f1g2 +Revises: +Create Date: 2023-12-20 10:00:00.000000 +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.sql import func +import uuid + +# revision identifiers +revision = 'b7c8d9e0f1g2' +down_revision = None +branch_labels = None +depends_on = None + +def upgrade(): + op.create_table( + 'pastors', + sa.Column('id', sa.String(), primary_key=True, default=lambda: str(uuid.uuid4())), + sa.Column('name', sa.String(), nullable=False, index=True), + sa.Column('church_name', sa.String(), nullable=False), + sa.Column('location', sa.String(), nullable=False), + sa.Column('age', sa.Integer(), nullable=False), + sa.Column('bio', sa.Text(), nullable=True), + sa.Column('website', sa.String(), nullable=True), + sa.Column('social_media', sa.String(), nullable=True), + sa.Column('specialty', sa.String(), nullable=True), + sa.Column('years_in_ministry', sa.Integer(), nullable=True), + sa.Column('followers_count', sa.Integer(), default=0), + sa.Column('is_active', sa.Boolean(), default=True), + sa.Column('created_at', sa.DateTime(), server_default=sa.func.now()), + sa.Column('updated_at', sa.DateTime(), server_default=sa.func.now(), onupdate=sa.func.now()), + sa.PrimaryKeyConstraint('id') + ) + + op.create_index('ix_pastors_name', 'pastors', ['name']) + +def downgrade(): + op.drop_index('ix_pastors_name', 'pastors') + op.drop_table('pastors') \ No newline at end of file