Closed AlexDo1 closed 3 years ago
I would like to try this, but I am not sure what to do.
I need to create a new file "rev4" and write some code for UPGRADE_SQL
and DONWGRADE_SQL
, right?
Which table would I have to change in metacatalog for the new EntryGroup?
The table entrygroup_types already looks (?):
I would like to try this, but I am not sure what to do.
I need to create a new file "rev4" and write some code for
UPGRADE_SQL
andDONWGRADE_SQL
, right?
Yeah. But you also need to import and add the new file in the /db/revisions/__init__.py
file. It's easier to use the metacatalog CLI for this:
python -m metacatalog migrate revision
That will include and add all needed files and you just need to update the file.
Which table would I have to change in metacatalog for the new EntryGroup?
For this revision, you don't change any Table. You need to add a new entry. Have a look at rev3.py
, where Person.uuid
is updated. This is how you can add a new entry. Alternatively, you can write the plain SQL and execute it. The SQL for adding is similar to:
INSERT into entrygroup_types (name, description) values ('Split dataset', 'Lorem Ipsum ..')
The downgrade command should remove this entry again:
DELETE FROM entrygroup_types where name='Split dataset';
Best,
Perfect! I just merged this
BTW.: It's really important to implement the SQL like you did it and not to rely on id
fields. They are usually autofilled, and differ on the different systems. You can run the python -m metacatalog migrate downgrade
and then the python -m metacatalog migrate upgrade
command. After that, the new entry has another id...
Just to give you some background.
Codecov Report
56.10% <60.00%> (+0.01%)
Flags with carried forward coverage won't be shown. Click here to find out more.
100.00% <ø> (ø)
70.73% <ø> (ø)
60.00% <60.00%> (ø)
Continue to review full report at Codecov.