rename migration files to be sorted alphabetically

This commit is contained in:
sam 2024-03-20 16:26:00 +01:00
parent 8e752689df
commit 03e7fb0bb2
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
5 changed files with 96 additions and 0 deletions

View file

@ -9,6 +9,7 @@ script_location = alembic
# see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file # see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
# for all available tokens # for all available tokens
# file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s # file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
file_template = %%(epoch)s_%%(slug)s
# sys.path path, will be prepended to sys.path if present. # sys.path path, will be prepended to sys.path if present.
# defaults to the current working directory. # defaults to the current working directory.

View file

@ -0,0 +1,54 @@
"""Add names/pronouns/fields
Revision ID: 1d8f8443a7f5
Revises: 0b63f7c8ab96
Create Date: 2024-03-20 15:36:08.756635
"""
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 = "1d8f8443a7f5"
down_revision: Union[str, None] = "0b63f7c8ab96"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.add_column(
"users",
sa.Column(
"names",
postgresql.JSONB(astext_type=sa.Text()),
nullable=False,
server_default="[]",
),
)
op.add_column(
"users",
sa.Column(
"pronouns",
postgresql.JSONB(astext_type=sa.Text()),
nullable=False,
server_default="[]",
),
)
op.add_column(
"users",
sa.Column(
"fields",
postgresql.JSONB(astext_type=sa.Text()),
nullable=False,
server_default="[]",
),
)
def downgrade() -> None:
op.drop_column("users", "fields")
op.drop_column("users", "pronouns")
op.drop_column("users", "names")

View file

@ -0,0 +1,41 @@
"""Add members
Revision ID: 17cc8cb77be5
Revises: 1d8f8443a7f5
Create Date: 2024-03-20 16:00:59.251354
"""
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 = '17cc8cb77be5'
down_revision: Union[str, None] = '1d8f8443a7f5'
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('members',
sa.Column('id', sa.BigInteger(), nullable=False),
sa.Column('name', sa.Text(), nullable=False),
sa.Column('display_name', sa.Text(), nullable=True),
sa.Column('bio', sa.Text(), nullable=True),
sa.Column('names', postgresql.JSONB(astext_type=sa.Text()), nullable=False),
sa.Column('pronouns', postgresql.JSONB(astext_type=sa.Text()), nullable=False),
sa.Column('fields', postgresql.JSONB(astext_type=sa.Text()), nullable=False),
sa.Column('user_id', sa.BigInteger(), nullable=False),
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('members')
# ### end Alembic commands ###