Coder Social home page Coder Social logo

Comments (7)

babelouest avatar babelouest commented on July 22, 2024

I'm nit sure of what you want to do with TIMESTAMP NULL, AFAIK, if you don't specify NOT NULL on a column, its value can be NULL, so I think the fix won't change anything. What is the problem you had when you imported the schema?

from glewlwyd.

vidcentum avatar vidcentum commented on July 22, 2024

Thanks, @babelouest . When I imported the schema without the fix, the following errors occurred.
DB: MySQL.
...
ERROR 1067 (42000): Invalid default value for 'grp_reset_at'
ERROR 1146 (42S02): Table 'es-users.g_reset_password' doesn't exist
ERROR 1067 (42000): Invalid default value for 'grt_last_seen'
ERROR 1146 (42S02): Table 'es-users.g_refresh_token' doesn't exist
ERROR 1215 (HY000): Cannot add foreign key constraint
ERROR 1067 (42000): Invalid default value for 'gss_last_seen'
ERROR 1146 (42S02): Table 'es-users.g_session' doesn't exist

ERROR 1215 (HY000): Cannot add foreign key constraint
...
The following tables were not created
g_refresh_token_scope
g_client_scope
g_access_token
g_refresh_token
g_session
g_reset_password

Then I executed each SQL statement separately to find out the issue. The error was due to default value of the TIMESTAMP field.

Further, I made explicit TIMESTAMP NULL

Reference:

https://dev.mysql.com/doc/refman/5.7/en/timestamp-initialization.html
TIMESTAMP Initialization and the NULL Attribute
By default, TIMESTAMP columns are NOT NULL, cannot contain NULL values, and assigning NULL assigns the current timestamp. To permit a TIMESTAMP column to contain NULL, explicitly declare it with the NULL attribute.

By setting TIMESTAMP NULL, I was able to import schema successfully.

from glewlwyd.

babelouest avatar babelouest commented on July 22, 2024

yup, I see it, we probably have different configuration on our mariadb servers, but if you want to set the default value to NULL on timestamps, I suggest you use the more explicit DEFAULT NULL instead of NULL only. Can you update your pull request with that?

from glewlwyd.

vidcentum avatar vidcentum commented on July 22, 2024

Sure, I have updated the file. Could you please check?

Best Regards
Maruthi

from glewlwyd.

vidcentum avatar vidcentum commented on July 22, 2024

@babelouest , I tested with TIMESTAMP DEFAULT NULL, and it did not fix the problem. Importing the schema failed again with DEFAULT NULL.
So, I had to revert it to TIMESTAMP NULL.

You may please check the same in your MySQL servers.

from glewlwyd.

babelouest avatar babelouest commented on July 22, 2024

I may have a different configuration on my server because this problem never occurred, and I use this script a lot to test the application in a clean environment. But this syntax seems correct and fix your problem so I'm totally OK.

from glewlwyd.

vidcentum avatar vidcentum commented on July 22, 2024

Thanks @babelouest , I will close the issue.

from glewlwyd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.