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

Django 2.2 and and Firebird 3 support #111

Merged
merged 28 commits into from May 4, 2020

Conversation

vasiliy-yashkov
Copy link
Contributor

@vasiliy-yashkov vasiliy-yashkov commented Apr 30, 2020

Improvements:

  1. Separate transaction for DDL statement. Each transaction is committed to make the changes visible to other statements. It's managed by 'autocommits_when_autocommit_is_off' feature. Set it to 'False' to disable separate transactions.
  2. Limit on creating big VARCHAR fields. If size is exceeded, it's changed to allowed. For big VARCHAR field an index with hash expression is created.
  3. Index with hash expression for big unique constraints. It's not possible to create a unique on big VARCHAR. Instead of it an unique index is created using hash expression.
  4. Implemented disabling and enabling constraint checking. To disable and enable constraint checking are created additional tables. 'django$constraint' and 'django$constraint_segment' store foreigns keys, unique fields and checks until constraint check is enabled.
  5. Altering field from blob type from/to another type. Firebird does not support direct type change to/from BLOB type. It was split into 4 steps:
    5.1. Make a temp blob column.
    5.2. Write the old column data to the new blob column.
    5.3. Drop the old column.
    5.4. Rename the temp column to old name.
  6. Support for AutoField and BigAutoField integer fields.
  7. Support for BOOLEAN type.

Fixed:

  1. Altering column from NULL to NOT NULL and vice versa.
  2. Default parameter passing for column. Default value is added to query instead of passing as parameter.
  3. Processing dates and datetimes expressions. No need to return an empty parameter list, but only sql text.
  4. Using of DISTINCT keyword for building sql queries.
  5. Checking of connection parameters.
  6. Updating null fields with default values before alter. A query to set default value is executed immediately to avoid errors.
  7. Using host and port for test database creation.
  8. Checking if a sequence exists before deleting.
  9. Parsing server version. The server version is parsed in the following order: full version, platform, type, major, minor, variant, build, server name.
  10. Combining of duration expression. If the expression contains a string type containing a integer or bigint value, using DATEADD function.
  11. Minor fixes for sql queries to work with Firebird 3.
  12. Fixes related to the django version. Updating imports, etc.

Tested with Django 2.2.10/2.2.11 and Firebird 3.0.5.

vasiliy-yashkov and others added 28 commits Mar 5, 2020
Major changes:
1. Each execution of DDL is committed to a separate transaction. Because Firebird does not support transactions in 'READ UNCOMMITTED' mode, it is necessary to commit each transaction that the changes are visible to other statements. Feature 'autocommits_when_autocommit_is_off' is 'True' by default. Set this feature to 'False' so that the module works as before.
2. Firebird does not support direct type change to BLOB, therefore this action is divided into 4 stages:
    1. Make a temp blob column.
    2. Write the old column data to the new blob column.
    3. Drop the old column.
    4. Rename the temp column to old name.
3. Fixed operations for working with date and datetime types. In particular, these functions return only a sql text, and not a list of sql statement and parameters.
4. Fixed tests to run correctly.
5. Fixed sql queries to work with Firebird 3.x.x.
6. Many fixes for the django version.

Tested with Django 2.2.10 and Firebird 3.0.5.
… tables

To disable and enable constraint checking, tables 'django$constraint' and 'django$constraint_segment' are created, in which foreigns keys, unique fields and checks are stored until constraint checking is turned off.
The server version is parsed in the following order: full version, platform, type, major, minor, variant, build, server name.
If the expression contains a string type containing a integer or bigint value, use DATEADD function.
If big varchar field is created must to make sure that its size does not exceed the allowable size; in addition, creating an index on a big varchar field uses a hash expression.
If when creating a unique constraint there is a varchar field for which it is impossible to create a normal index, because key size too big for index, a unique index is created with a hash expression by fields.
@maxirobaina maxirobaina merged commit 82f637c into maxirobaina:master May 4, 2020
This was referenced May 13, 2020
@maxirobaina maxirobaina added this to the 2.2.0 milestone Apr 20, 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.

None yet

3 participants