Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#738 update migrations to support mysql & env example #898

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ SAAS_ACTIVATE_ACCOUNT_PATH=/activate
SUBSCRIBIE_REPO_DIRECTORY=./
SQLALCHEMY_TRACK_MODIFICATIONS=False
SQLALCHEMY_DATABASE_URI="sqlite:////tmp/data.db"
# Mysql example
#SQLALCHEMY_DATABASE_URI="mysql+pymysql://username:password@host:port/databasename?charset=utf8mb4"
SECRET_KEY="random string. e.g. echo -e 'from os import urandom\\nprint urandom(25)' | python"
DB_FULL_PATH="/tmp/data.db"
MODULES_PATH="./modules/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

def upgrade():
with op.batch_alter_table("subscription") as batch_op:
batch_op.add_column(sa.Column("stripe_cancel_at", sa.String(), nullable=True))
batch_op.add_column(sa.Column("stripe_cancel_at", sa.String(255), nullable=True))


def downgrade():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
def upgrade():
with op.batch_alter_table("subscription") as batch_op:
batch_op.add_column(
sa.Column("subscribie_checkout_session_id", sa.String(), nullable=True)
sa.Column("subscribie_checkout_session_id", sa.String(255), nullable=True)
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ def upgrade():
"upcoming_invoice",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("created_at", sa.DateTime(), nullable=True),
sa.Column("stripe_subscription_id", sa.String(), nullable=True),
sa.Column("stripe_invoice_status", sa.String(), nullable=True),
sa.Column("stripe_amount_due", sa.String(), nullable=True),
sa.Column("stripe_amount_paid", sa.String(), nullable=True),
sa.Column("stripe_currency", sa.String(), nullable=True),
sa.Column("stripe_next_payment_attempt", sa.String(), nullable=True),
sa.Column("subscription_uuid", sa.Integer(), nullable=True),
sa.Column("stripe_subscription_id", sa.String(255), nullable=True),
sa.Column("stripe_invoice_status", sa.String(255), nullable=True),
sa.Column("stripe_amount_due", sa.String(255), nullable=True),
sa.Column("stripe_amount_paid", sa.String(255), nullable=True),
sa.Column("stripe_currency", sa.String(255), nullable=True),
sa.Column("stripe_next_payment_attempt", sa.String(255), nullable=True),
sa.Column("subscription_uuid", sa.String(255), nullable=True, index=True),
sa.ForeignKeyConstraint(
["subscription_uuid"],
["subscription.uuid"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@


# revision identifiers, used by Alembic.
revision = '3abcbb0428ef'
down_revision = '790aae5a7013'
revision = "3abcbb0428ef"
down_revision = "790aae5a7013"
branch_labels = None
depends_on = None


def upgrade():
with op.batch_alter_table("payment_provider") as batch_op:
batch_op.add_column(sa.Column('stripe_connect_account_id', sa.String(), nullable=True))
batch_op.add_column(
sa.Column("stripe_connect_account_id", sa.String(255), nullable=True)
)


def downgrade():
Expand Down
4 changes: 2 additions & 2 deletions migrations/versions/500f2d55c5d3_add_logintoken_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('login_token',
sa.Column('user_uuid', sa.String(), nullable=False),
sa.Column('login_token', sa.String(), nullable=True),
sa.Column('user_uuid', sa.String(255), nullable=False),
sa.Column('login_token', sa.String(255), nullable=True),
sa.PrimaryKeyConstraint('user_uuid')
)
# ### end Alembic commands ###
Expand Down
2 changes: 1 addition & 1 deletion migrations/versions/53840eddbb0f_add_taxrate_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def upgrade():
op.create_table(
"tax_rate",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("stripe_tax_rate_id", sa.String(), nullable=True),
sa.Column("stripe_tax_rate_id", sa.String(255), nullable=True),
sa.Column("created_at", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("id"),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
def upgrade():
with op.batch_alter_table("payment_provider") as batch_op:
batch_op.add_column(
sa.Column("stripe_test_connect_account_id", sa.String(), nullable=True)
sa.Column("stripe_test_connect_account_id", sa.String(255), nullable=True)
)
batch_op.add_column(
sa.Column("stripe_test_webhook_endpoint_id", sa.String(), nullable=True)
sa.Column("stripe_test_webhook_endpoint_id", sa.String(255), nullable=True)
)
batch_op.add_column(
sa.Column("stripe_test_webhook_endpoint_secret", sa.String(), nullable=True)
sa.Column(
"stripe_test_webhook_endpoint_secret", sa.String(255), nullable=True
)
)


Expand Down
14 changes: 7 additions & 7 deletions migrations/versions/5e756a48f86d_add_stripeinvoice_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
def upgrade():
op.create_table(
"stripe_invoice",
sa.Column("uuid", sa.String(), nullable=False),
sa.Column("id", sa.String(), nullable=True),
sa.Column("status", sa.String(), nullable=True),
sa.Column("uuid", sa.String(255), nullable=False),
sa.Column("id", sa.String(255), nullable=True),
sa.Column("status", sa.String(255), nullable=True),
sa.Column("amount_due", sa.Integer(), nullable=True),
sa.Column("amount_paid", sa.Integer(), nullable=True),
sa.Column("amount_remaining", sa.Integer(), nullable=True),
sa.Column("application_fee_amount", sa.Integer(), nullable=True),
sa.Column("attempt_count", sa.Integer(), nullable=True),
sa.Column("billing_reason", sa.String(), nullable=True),
sa.Column("collection_method", sa.String(), nullable=True),
sa.Column("currency", sa.String(), nullable=True),
sa.Column("billing_reason", sa.String(255), nullable=True),
sa.Column("collection_method", sa.String(255), nullable=True),
sa.Column("currency", sa.String(255), nullable=True),
sa.Column("next_payment_attempt", sa.Integer(), nullable=True),
sa.Column("stripe_subscription_id", sa.String(), nullable=True),
sa.Column("stripe_subscription_id", sa.String(255), nullable=True),
sa.Column("subscribie_subscription_id", sa.Integer(), nullable=True),
sa.Column("stripe_invoice_raw_json", sa.JSON(), nullable=True),
sa.ForeignKeyConstraint(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

def upgrade():
with op.batch_alter_table("module_style") as batch_op:
batch_op.add_column(sa.Column("bg_primary", sa.String(), nullable=True))
batch_op.add_column(sa.Column("bg_primary", sa.String(255), nullable=True))


def downgrade():
Expand Down
Loading