-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Create migration on CodebaseResource to append extension to name, if name does not end with extension * Update exptected test results Signed-off-by: Jono Yang <[email protected]>
- Loading branch information
Showing
16 changed files
with
1,589 additions
and
1,538 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Generated by Django 4.0.6 on 2022-08-04 18:36 | ||
|
||
from django.db import migrations | ||
from django.db.models import F, Q | ||
from django.db.models.functions import Concat | ||
|
||
|
||
def concat_codebaseresource_name_and_extension(apps, schema_editor): | ||
CodebaseResource = apps.get_model('scanpipe', 'CodebaseResource') | ||
qs = CodebaseResource.objects.filter( | ||
Q(extension__isnull=False) # Has an "extension" value | ||
& ~Q(name__endswith=F("extension")) # "name" do not ends with the "extension" | ||
) | ||
qs.update(name=Concat(F("name"), F("extension"))) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('scanpipe', '0018_codebaseresource_tag'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(concat_codebaseresource_name_and_extension), | ||
] |
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,18 @@ | ||
# Generated by Django 4.0.6 on 2022-08-09 17:08 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('scanpipe', '0019_auto_20220804_1836'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='codebaseresource', | ||
name='name', | ||
field=models.CharField(blank=True, help_text='File or directory name of this resource with its extension.', max_length=255), | ||
), | ||
] |
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.