Skip to content

Feature: Replace field values with NULL #119

@MalteWunsch

Description

@MalteWunsch

Motivation: Let's say you have a table user and a table picture, with user.picture_id referenceing picture.id in a foreign key. You want to dump table user in full, but table picture only as schema (or not at all). If you configure slimdump this way:

<table name="user" dump="full"/>
<table name="picture" dump="schema"/>

Your dump might contain a non-NULL user.picture_id and if you try to import that, you get a foreign key constraint error.

Suggestion: Allow replacing field values with NULL, e.g. like this:

<table name="user" dump="full">
  <column name="picture_id" dump="replace" replacement="NULL" />
</table>
<table name="picture" dump="schema"/>

I'm not super happy with the proposed syntax, as it would prevent replacements with the literal string "NULL" (same problem with "FAKER_*" replacements, but with "FAKER_*" it is less likely you want to use the literal string as a replacement). Maybe a separate attribute for these special replacements would be better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions