-
Notifications
You must be signed in to change notification settings - Fork 0
Make ADK table drops conditional in migrations and update tsconfig #73
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,10 +21,11 @@ | |
| def upgrade() -> None: | ||
| """Upgrade schema.""" | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| op.drop_table('user_states') | ||
| op.drop_table('app_states') | ||
| op.drop_table('events') | ||
| op.drop_table('sessions') | ||
| conn = op.get_bind() | ||
| existing = sa.inspect(conn).get_table_names() | ||
| for tbl in ('user_states', 'app_states', 'events', 'sessions'): | ||
| if tbl in existing: | ||
| op.drop_table(tbl) | ||
|
Comment on lines
+24
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this migration runs after To keep the migration history clean, these redundant drop commands should be removed entirely from this migration. |
||
| with op.batch_alter_table('payment_transactions', schema=None) as batch_op: | ||
| batch_op.add_column(sa.Column('raw_webhook_payload', sa.JSON(), nullable=True)) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -31,5 +31,5 @@ | |||||
| ".next/dev/types/**/*.ts", | ||||||
| "**/*.mts" | ||||||
| ], | ||||||
| "exclude": ["node_modules"] | ||||||
| "exclude": ["node_modules", "tests"] | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Excluding the If the goal is to exclude tests from the production build output, it is better to keep them in
Suggested change
|
||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these two migrations are sequential in the migration chain, once the tables are dropped in the first migration, they will not exist when the second one runs. Instead of making the drops conditional in both files, the best practice is to keep the
drop_tablecommands in the migration where they are first introduced and completely remove them from the subsequent migration.If conditional drops are indeed necessary, you can use the built-in
if_exists=Trueparameter supported in Alembic 1.13.3+ instead of manually inspecting the connection.