-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[COST-4515] Upgrade to Django 4.1 (#4853)
* upgrade to Django 4.1 * Update deprecated ‘warn’ method * Remove deprecated test case method * Remove deprecated Series.bool method * Correct docstring and class attribute name * Cleanup file handle * Fix flaky test This assert statement will always fail since the template schema does not yet exists. This test will only pass if another test runs before this test creates the template schema. * Update clone_schema.sql Do not define a custom sequence object since that is no longer required with the move to identity columns. Co-authored-by: Michael Skarbek <[email protected]> Co-authored-by: David Nakabaale <[email protected]> * Update clone_schema SQL function when necessary We may not end up wanting this to be so automatic, but this is a good way to handle it if needed. The only problem is getting the hash is a bit clunky since the contents of clone_schema.sql do not exactly match the function definition once it is stored in the database. I added the hash output to logs in order to make updating the hash easier. * Avoid unnecessary globals * update comments in clone_schema func * Update clone_schema hash * add management cmd to migrate serial cols * Update clone_schema.sql Do not define a custom sequence object since that is no longer required with the move to identity columns. Co-authored-by: Michael Skarbek <[email protected]> Co-authored-by: David Nakabaale <[email protected]> * Update license information Add correct copyright and license information to management command. Create project level licenses to reflect the use of multiple licenses within the project. * Improvements to serial to identity management command - Use SQL composition rather than format strings to protect against SQL injection attacks. The risk is quite low, but it’s best to just do the right thing. - Reorganize the code to avoid a nested function definiton and an unnecessary global variable that only needed to be local. * Do not update clone_schema function automatically * Add migration to update clone_schema function * fixup! Improvements to serial to identity management command --------- Co-authored-by: Sam Doran <[email protected]> Co-authored-by: Michael Skarbek <[email protected]>
- Loading branch information
1 parent
8595845
commit 4f62011
Showing
22 changed files
with
327 additions
and
163 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated by Django 4.1.13 on 2024-02-02 16:08 | ||
import pathlib | ||
|
||
from django.db import migrations | ||
|
||
from koku.migration_sql_helpers import apply_sql_file | ||
from koku.migration_sql_helpers import find_db_functions_dir | ||
|
||
|
||
class Migration(migrations.Migration): | ||
def update_clone_schema_function(apps, schema_editor): | ||
path = pathlib.Path(find_db_functions_dir()) / "clone_schema.sql" | ||
apply_sql_file(schema_editor, path, literal_placeholder=True) | ||
|
||
dependencies = [ | ||
("api", "0061_alter_providerinfrastructuremap_unique_together"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
code=update_clone_schema_function, | ||
reverse_code=migrations.RunPython.noop, | ||
) | ||
] |
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
Oops, something went wrong.