-
-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
server/product: allow to create product with one_time price
- Loading branch information
1 parent
2ad3fbd
commit 571440b
Showing
8 changed files
with
141 additions
and
35 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
server/migrations/versions/2024-05-14-1632_add_productprice_type.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,50 @@ | ||
"""Add ProductPrice.type | ||
Revision ID: 8ca7adb6786e | ||
Revises: e437db540330 | ||
Create Date: 2024-05-14 16:32:20.907470 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# Polar Custom Imports | ||
from polar.kit.extensions.sqlalchemy import PostgresUUID | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "8ca7adb6786e" | ||
down_revision = "e437db540330" | ||
branch_labels: tuple[str] | None = None | ||
depends_on: tuple[str] | None = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column("product_prices", sa.Column("type", sa.String(), nullable=True)) | ||
op.execute("UPDATE product_prices SET type = 'recurring'") | ||
op.alter_column("product_prices", "type", existing_type=sa.String(), nullable=False) | ||
|
||
op.alter_column( | ||
"product_prices", | ||
"recurring_interval", | ||
existing_type=sa.VARCHAR(), | ||
nullable=True, | ||
) | ||
op.create_index( | ||
op.f("ix_product_prices_type"), "product_prices", ["type"], unique=False | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index(op.f("ix_product_prices_type"), table_name="product_prices") | ||
op.alter_column( | ||
"product_prices", | ||
"recurring_interval", | ||
existing_type=sa.VARCHAR(), | ||
nullable=False, | ||
) | ||
op.drop_column("product_prices", "type") | ||
# ### 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 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
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