Skip to content

IRIS workaround & SQL compatability #6

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

Merged
merged 6 commits into from
Mar 23, 2022
Merged

Conversation

nickmitchko
Copy link

This fix provides a workaround of DEFAULT values in alter statements and rename statements along with other SQL compatibility. (Changes mostly in schema.py). There is also a framework to inject our own SQL compiler in operations.py but I left that out of this commit as the other issues are fixed by the schema.py.

  • sql_rename_table = "ALTER TABLE %(old_table)s RENAME %(new_table)s"
    • Provides proper syntax to DJANGO for table rename statements
  • sql_rename_column = ( "ALTER TABLE %(table)s ALTER COLUMN %(old_column)s RENAME %(new_column)s" )
    • Provides proper syntax to DJANGO for column rename statements
  • DEFAULTs are supported on alter statements, two bugs prevents their casual use
    • ALTER TABLE <table> ADD COLUMN <col> <type> DEFAULT <value> doesn't work if <value> is a parameter and needs to be a prepared statement.
    • ALTER TABLE <table> ADD COLUMN <col> <type> DEFAULT <value> doesn't work if <col> is an escaped reserved keyword such as "interval"
    def skip_default_on_alter(self, field):
        """
        Some backends don't accept default values for certain columns types
        (i.e. MySQL longtext and longblob) in the ALTER COLUMN statement.
        """
        return True

    def skip_default(self, field):
        # return super().skip_default(field)
        return True```

@daimor daimor merged commit f3d9c3e into caretdev:main Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants