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

Can't create nullable timestamps #13099

Closed
1RV34 opened this Issue Sep 29, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@1RV34
Contributor

1RV34 commented Sep 29, 2017

Expected and Actual Behavior

I'm trying to use the Column class to create tables in my database. In these tables I try to create a timestamp column that is nullable using the following code:

new Column('deadline', 'type' => Column::TYPE_TIMESTAMP, 'notNull' => false, 'default' => null)

I would expect to have created a nullable timestamp column with its default value being null, however instead a timestamp column would be created with current_timestamp as default together with the on update current_timestamp property, all following timestamp columns will have default '0000-00-00 00:00:00'.

Details

  • Phalcon version: 3.2.1
  • PHP Version: 7.1.9
  • Operating System: ubuntu 16.04.1
  • Installation type: Compiling from source
  • Zephir version: 0.9.9
  • Server: Apache
  • Other related info:
    Generated query will have the following in it:
    CREATE TABLE `table` (
        `timestamp1` timestamp,
        `timestamp2` timestamp
    );
    which will result in a table with columns like:
    CREATE TABLE `table` (
        `timestamp1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURENT_TIMESTAMP,
        `timestamp2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
    );
    Instead it should generate:
    CREATE TABLE `table` (
        `timestamp1` timestamp NULL DEFAULT NULL,
        `timestamp2` timestamp NULL DEFAULT NULL
    );

@1RV34 1RV34 referenced this issue Sep 29, 2017

Merged

Explicitly define nullable columns #13100

3 of 3 tasks complete
@sergeyklay

This comment has been minimized.

Member

sergeyklay commented Sep 29, 2017

As you can see tests failed

Failures: 40

@sergeyklay sergeyklay added this to the 3.3.x milestone Sep 29, 2017

@1RV34

This comment has been minimized.

Contributor

1RV34 commented Sep 29, 2017

I saw, working on updating the tests.

@1RV34

This comment has been minimized.

Contributor

1RV34 commented Sep 29, 2017

Do you think this fix could be included with 3.2.x, since it's a bugfix not a feature? (Current Phalcon system doesn't respond to 'notNull' => false correctly and causes issues. It's causing our applications to break.)

@1RV34 1RV34 closed this Sep 29, 2017

@1RV34 1RV34 reopened this Sep 29, 2017

@1RV34

This comment has been minimized.

Contributor

1RV34 commented Sep 29, 2017

Sorry, wrong button.

@sergeyklay sergeyklay self-assigned this Oct 2, 2017

@sergeyklay sergeyklay modified the milestones: 3.3.x, 3.4.x Mar 24, 2018

@sergeyklay sergeyklay removed this from the 3.4.x milestone Jun 1, 2018

@stale stale bot added the stale label Aug 30, 2018

@stale stale bot closed this Aug 31, 2018

@sergeyklay sergeyklay added this to the 3.4.2 milestone Oct 19, 2018

@phalcon phalcon deleted a comment from stale bot Oct 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment