-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat (import): Support constant values in the mapping (#3271)
* feat(import): can post fieldmapping in new structured format * fix(import): insert_import_data_in_transient_table * fix(import): get_import_values * fix(import): prepare_import * feat(import): support default values * feat(import): default value edition support nomenclature widget refactor(import): minor refact on getFieldMappingValues() * feat(import): improve default value json edition * feat(import): present default values on report * feat(import): db migration * feat(import): test default value * test(import): support fieldmapping format v2 * feat(import): dynamic form on default values * fix(import): no longer send empty string for date default value * fix(import): test field jsonschema_definitions * feat(import): fix occhab revisions * feat(import): rename obsolete revision * style(import): code format * feat(import): fieldmapping validators deal with default values * feat(import): occhab revision to set bib_fields.type_field * Fix (migration) move migration to geonature branch --------- Co-authored-by: Pierre-Narcisi <[email protected]>
- Loading branch information
1 parent
08ec80d
commit 38aea2f
Showing
30 changed files
with
780 additions
and
267 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
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
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
59 changes: 59 additions & 0 deletions
59
.../geonature/migrations/versions/imports/a94bea44ab56_type_field_conforms_to_type_widget.py
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,59 @@ | ||
"""bib_field.type_field conforms to dynamic_form.type_widget | ||
Revision ID: a94bea44ab56 | ||
Revises: e43b01a18850 | ||
Create Date: 2024-12-11 15:44:52.912515 | ||
""" | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "a94bea44ab56" | ||
down_revision = "e43b01a18850" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
op.execute( | ||
""" | ||
ALTER TABLE gn_imports.bib_fields ADD type_field_params jsonb NULL; | ||
""" | ||
) | ||
op.execute( | ||
""" | ||
UPDATE gn_imports.bib_fields | ||
SET type_field = | ||
case | ||
-- mnemonique is handled front side | ||
WHEN mnemonique IS NOT NULL AND mnemonique != '' THEN NULL | ||
-- multi is handled front side | ||
WHEN multi = true THEN null | ||
WHEN type_field IN ('integer', 'real') THEN 'number' | ||
WHEN type_field IN ('geometry', 'jsonb', 'json', 'wkt') THEN 'textarea' | ||
WHEN type_field LIKE 'timestamp%' THEN 'date' | ||
WHEN type_field ~ '^character varying\((\d+)\)$' | ||
AND COALESCE(substring(type_field FROM '\d+')::int, 0) > 68 THEN 'textarea' | ||
-- Default: garder la valeur actuelle. | ||
ELSE NULL | ||
END; | ||
""" | ||
) | ||
|
||
|
||
def downgrade(): | ||
op.execute( | ||
""" | ||
ALTER TABLE gn_imports.bib_fields DROP COLUMN type_field_params; | ||
""" | ||
) |
Oops, something went wrong.