-
-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
server/checkout: allow to pass customer_metadata that'll be copied ov…
…er to the created customer
- Loading branch information
1 parent
2d55075
commit 6c8d3e8
Showing
7 changed files
with
148 additions
and
16 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
server/migrations/versions/2024-12-17-1756_add_checkout_customer_metadata.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,43 @@ | ||
"""Add Checkout.customer_metadata | ||
Revision ID: cb9906114207 | ||
Revises: a3e70f4c4e1e | ||
Create Date: 2024-12-17 17:56:12.495724 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# Polar Custom Imports | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "cb9906114207" | ||
down_revision = "a3e70f4c4e1e" | ||
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( | ||
"checkouts", | ||
sa.Column( | ||
"customer_metadata", postgresql.JSONB(astext_type=sa.Text()), nullable=True | ||
), | ||
) | ||
|
||
op.execute( | ||
"UPDATE checkouts SET customer_metadata = '{}' WHERE customer_metadata IS NULL" | ||
) | ||
|
||
op.alter_column("checkouts", "customer_metadata", nullable=False) | ||
|
||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_column("checkouts", "customer_metadata") | ||
# ### 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