Skip to content

Cannot save array values on record creation #914

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

Closed
AlexanderBich opened this issue Sep 9, 2021 · 1 comment
Closed

Cannot save array values on record creation #914

AlexanderBich opened this issue Sep 9, 2021 · 1 comment

Comments

@AlexanderBich
Copy link

AlexanderBich commented Sep 9, 2021

When I try to create a record with array property inside it ingores provided array values and saves a record without them.
P.S. edit works fine, so the issue is only with creation

Installed libraries and their versions

PostgreSQL:13.3

To Reproduce
Steps to reproduce the behavior:

  1. Click on 'Create new' on resource with array field inside
  2. Fill array field with values
  3. Bug: It will create record without those provided array values

Expected behavior
It should save array values on creation of a new record

Screenshots
If applicable, add screenshots to help explain your problem.

image

After creation:
image

AdminJSOptions with schema
Paste your AdminJS config with database schema if it could be related to the issue

AdminJS resource config

CompanyResource = {
  resource: Company,
  options: {
    navigation: {
      name: null,
    },
    properties: {
      id: {
        name: 'string',
        isVisible: false,
      },
      name: {
        type: 'string',
      },
      email: {
        type: 'string',
      },
      phoneNumbers: {
        isArray: true,
        type: 'string',
        isVisible: { list: false, filter: false, show: true, edit: true },
      },
    },
  },
};

database schema:

-- auto-generated definition
create table companies
(
    id            uuid default gen_random_uuid() not null
        constraint "PK_d4bc3e82a314fa9e29f652c2c22"
            primary key,
    name          varchar                        not null,
    email         varchar                        not null,
    socials       jsonb,
    phone_numbers text[]                         not null,
    comments      text
);

alter table companies
    owner to postgres;

Additional context
Before I added default value as empty array array[]::text[] to phone_numbers it was throwing me null violation exception from postgres.

@AlexanderBich
Copy link
Author

Closed, because it's related to a different package and here's a PR for it:
SoftwareBrothers/adminjs-typeorm#16

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

No branches or pull requests

1 participant