-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
872 additions
and
84 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
alembic/versions/5014a1d75251_merge_freudpoints_and_confession_.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,24 @@ | ||
"""merge freudpoints and confession exposure | ||
Revision ID: 5014a1d75251 | ||
Revises: 65f0d772d7ba, 7f5cc27e7f61 | ||
Create Date: 2023-10-12 16:13:29.299389 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "5014a1d75251" | ||
down_revision = ("65f0d772d7ba", "7f5cc27e7f61") | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
pass | ||
|
||
|
||
def downgrade() -> None: | ||
pass |
87 changes: 87 additions & 0 deletions
87
alembic/versions/65f0d772d7ba_add_freudpoint_related_things.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,87 @@ | ||
"""add FreudPoint related things | ||
Revision ID: 65f0d772d7ba | ||
Revises: 2adbec7716ff | ||
Create Date: 2023-10-05 16:26:53.915342 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "65f0d772d7ba" | ||
down_revision = "2adbec7716ff" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.create_table( | ||
"profile_statistics", | ||
sa.Column( | ||
"profile_discord_id", | ||
sa.BigInteger, | ||
sa.ForeignKey("profile.discord_id"), | ||
nullable=False, | ||
), | ||
sa.Column( | ||
"config_guild_id", | ||
sa.BigInteger, | ||
sa.ForeignKey("config.guild_id"), | ||
nullable=False, | ||
), | ||
sa.Column( | ||
"freudpoints", sa.Integer, nullable=False, default=0, server_default="0" | ||
), | ||
sa.Column( | ||
"spendable_freudpoints", | ||
sa.Integer, | ||
nullable=False, | ||
default=1, | ||
server_default="1", | ||
), | ||
) | ||
|
||
op.create_primary_key( | ||
"pk_profilestat_discordid_guildid", | ||
"profile_statistics", | ||
["profile_discord_id", "config_guild_id"], | ||
) | ||
|
||
op.create_check_constraint( | ||
"freudpoints_min_0", "profile_statistics", "freudpoints >= 0" | ||
) | ||
op.create_check_constraint( | ||
"spendable_freudpoints_min_0", | ||
"profile_statistics", | ||
"spendable_freudpoints >= 0", | ||
) | ||
|
||
op.add_column( | ||
"config", | ||
sa.Column( | ||
"max_spendable_freudpoints", | ||
sa.Integer, | ||
nullable=False, | ||
default=5, | ||
server_default="5", | ||
), | ||
) | ||
|
||
op.create_check_constraint( | ||
"max_spendable_freudpoints_min_0", "config", "max_spendable_freudpoints >= 0" | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_constraint("max_spendable_freudpoints_min_0", "config", type_="check") | ||
|
||
op.drop_column("config", "max_spendable_freudpoints") | ||
|
||
op.drop_constraint( | ||
"spendable_freudpoints_min_0", "profile_statistics", type_="check" | ||
) | ||
op.drop_constraint("freudpoints_min_0", "profile_statistics", type_="check") | ||
|
||
op.drop_table("profile_statistics") |
29 changes: 29 additions & 0 deletions
29
alembic/versions/7f5cc27e7f61_add_confession_exposure_counter.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,29 @@ | ||
"""add confession exposure counter | ||
Revision ID: 7f5cc27e7f61 | ||
Revises: 2adbec7716ff | ||
Create Date: 2023-10-07 21:43:38.674746 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "7f5cc27e7f61" | ||
down_revision = "2adbec7716ff" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.add_column( | ||
"profile", | ||
sa.Column( | ||
"confession_exposed_count", sa.Integer, nullable=False, server_default="0" | ||
), | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_column("profile", "confession_exposed_count") |
54 changes: 54 additions & 0 deletions
54
alembic/versions/a37a393bc831_move_exposed_count_to_profile_statistics.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,54 @@ | ||
"""move exposed count to profile_statistics | ||
Revision ID: a37a393bc831 | ||
Revises: 5014a1d75251 | ||
Create Date: 2023-10-12 16:16:04.210967 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "a37a393bc831" | ||
down_revision = "5014a1d75251" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.add_column( | ||
"profile_statistics", | ||
sa.Column( | ||
"confession_exposed_count", | ||
sa.Integer, | ||
nullable=False, | ||
default=0, | ||
server_default="0", | ||
), | ||
) | ||
|
||
op.execute( | ||
"update profile_statistics set confession_exposed_count=p.confession_exposed_count from profile p where profile_discord_id=p.discord_id" | ||
) | ||
|
||
op.drop_column("profile", "confession_exposed_count") | ||
|
||
|
||
def downgrade() -> None: | ||
op.add_column( | ||
"profile", | ||
sa.Column( | ||
"confession_exposed_count", | ||
sa.Integer, | ||
nullable=False, | ||
default=0, | ||
server_default="0", | ||
), | ||
) | ||
|
||
op.execute( | ||
"update profile set confession_exposed_count=s.confession_exposed_count from profile_statistics s where discord_id=s.profile_discord_id" | ||
) | ||
|
||
op.drop_column("profile_statistics", "confession_exposed_count") |
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
Oops, something went wrong.