Skip to content
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

All fields on the revision table are marked as not null. #318

Closed
ghost opened this issue Apr 4, 2018 · 6 comments
Closed

All fields on the revision table are marked as not null. #318

ghost opened this issue Apr 4, 2018 · 6 comments
Labels

Comments

@ghost
Copy link

ghost commented Apr 4, 2018

Q A
Bug report? yes
Feature request? no
BC Break report? no
Used Version 1.0.8

The revision table that is created during the schema generation is marking all of the fields as "NOT NULL", even though a lot of them are nullable. This is causing integrity constraint violations when a revision is saved.

@montaniasystemab
Copy link

It seems like this issue is introduced with doctrine/dbal v2.7, for a quick workaround you might solve this issue by locking doctrine/dbal to version v2.6 in your composer file:

"doctrine/dbal": "v2.6.*"

@ghost
Copy link
Author

ghost commented Apr 5, 2018

Thanks, I'll try that out and see what happens. While my solution worked for my specific case, I just realized that 'notnull' => false is the same as 'null' => true. Having double negatives in the code is -really- confusing.

So does this mean that the EntityAuditBundle is not compatible with Doctrine/DBAL > 2.6 and is there a plan to make it compatible?

@tolry
Copy link
Contributor

tolry commented Apr 5, 2018

@c-butcher as we have no real active maintainer for this package, it's sure to say, that no tests against dbal 2.7 were done 😄 2.6->2.7 should in theory have no BC breaks, ... therefore version restrictions in EntityAuditBundle allow <3.0

If changes can be made to allow usage with any 2.x version, I am happy to merge those.

For the double negatives: I agree, quite confusing - I guess the reason for this in doctrine was to make not-nullable the default, since nullable collumns always make trouble in edge cases 😁

@axzx
Copy link

axzx commented Apr 6, 2018

There are more problems

./bin/console d:s:u --dump-sql:

ALTER TABLE app_state_audit ALTER pa_id TYPE VARCHAR(255);
ALTER TABLE app_tag_audit ALTER use_counter DROP DEFAULT;
ALTER TABLE user_company_audit ALTER minimum_order_value TYPE NUMERIC(10, 0);

my db schma:

CREATE TABLE app_state
(  
  pa_id character varying(3) DEFAULT NULL::character varying
)

CREATE TABLE app_tag
(
  use_counter integer NOT NULL DEFAULT 0,
)

CREATE TABLE user_company
(
  minimum_order_value numeric(9,2) DEFAULT NULL::numeric,
)

phansys added a commit to phansys/EntityAudit that referenced this issue Apr 8, 2018
@phansys
Copy link
Member

phansys commented Apr 8, 2018

@c-butcher, could you please confirm if #320 fixes the issue?
Thank you.

tolry added a commit that referenced this issue Apr 10, 2018
[#318] Add conflict with "doctrine/dbal:2.7.0"
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants