Uploaded image for project: 'ID Generation'
  1. ID Generation
  2. IDGEN-53

Invalid default value for 'date_created' on MySQL 5.7.16

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Should
    • Resolution: Fixed
    • None
    • 4.4.1
    • None

    Description

      When running on MySQL 5.7.16, some get this error message

      WARN - ModuleFactory.startModuleInternal(788) |2017-01-24 12:34:09,814| Error while trying to start module: idgen
      org.openmrs.api.db.DAOException: Error while running sql: CREATE TABLE `idgen_identifier_source` (
                    `id` int(11) NOT NULL auto_increment,
                    `uuid` char(38) NOT NULL,
                    `name` varchar(255) NOT NULL,
                    `description` varchar(1000),
                    `identifier_type` int(11) NOT NULL default '0',
                    `creator` int(11) NOT NULL default '0',
                    `date_created` datetime NOT NULL default '0000-00-00 00:00:00',
                    `changed_by` int(11) default NULL,
                    `date_changed` datetime default NULL,
                    `retired` tinyint(1) NOT NULL default 0,
                    `retired_by` int(11) default NULL,
                    `date_retired` datetime default NULL,
                    `retire_reason` varchar(255) default NULL,
                    PRIMARY KEY  (`id`),
                    KEY `id for idgen_identifier_source` (`id`),
                    KEY `identifier_type for idgen_identifier_source` (`identifier_type`),
                    KEY `creator for idgen_identifier_source` (`creator`),
                    KEY `changed_by for idgen_identifier_source` (`changed_by`),
                    KEY `retired_by for idgen_identifier_source` (`retired_by`),
                    CONSTRAINT `identifier_type for idgen_identifier_source` FOREIGN KEY (`identifier_type`) REFERENCES `patient_identifier_type` (`patient_identifier_type_id`),
                    CONSTRAINT `creator for idgen_identifier_source` FOREIGN KEY (`creator`) REFERENCES `users` (`user_id`),
                    CONSTRAINT `changed_by for idgen_identifier_source` FOREIGN KEY (`changed_by`) REFERENCES `users` (`user_id`),
                    CONSTRAINT `retired_by for idgen_identifier_source` FOREIGN KEY (`retired_by`) REFERENCES `users` (`user_id`)
                  ) ENGINE=InnoDB DEFAULT CHARSET=utf8 . Message: Invalid default value for 'date_created'
          at org.openmrs.util.DatabaseUtil.populateResultsFromSQLQuery(DatabaseUtil.java:159)
          at org.openmrs.util.DatabaseUtil.access$000(DatabaseUtil.java:34)
          at org.openmrs.util.DatabaseUtil$1.execute(DatabaseUtil.java:98)
          at org.hibernate.jdbc.WorkExecutor.executeWork(WorkExecutor.java:54)
          at org.hibernate.internal.SessionImpl$2.accept(SessionImpl.java:2076)
          at org.hibernate.internal.SessionImpl$2.accept(SessionImpl.java:2073)
          at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.coordinateWork(JdbcCoordinatorImpl.java:313)
          at org.hibernate.internal.SessionImpl.doWork(SessionImpl.java:2095)
          at org.hibernate.internal.SessionImpl.doWork(SessionImpl.java:2080)
          at org.openmrs.util.DatabaseUtil.executeSQL(DatabaseUtil.java:94)
          at org.openmrs.api.db.hibernate.HibernateAdministrationDAO.executeSQL(HibernateAdministrationDAO.java:169)
          at org.openmrs.api.impl.AdministrationServiceImpl.executeSQL(AdministrationServiceImpl.java:298)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
          at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
          at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
          at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
          at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
          at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
          at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
          at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
          at com.sun.proxy.$Proxy156.executeSQL(Unknown Source)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
          at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
          at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
          at org.openmrs.aop.LoggingAdvice.invoke(LoggingAdvice.java:121)
          at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
          at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
          at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
          at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
          at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
          at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
          at com.sun.proxy.$Proxy158.executeSQL(Unknown Source)
          at org.openmrs.module.ModuleFactory.runDiff(ModuleFactory.java:940)
          at org.openmrs.module.ModuleFactory.startModuleInternal(ModuleFactory.java:718)
          at org.openmrs.api.context.Daemon$1.run(Daemon.java:74)
      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Invalid default value for 'date_created'
          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
          at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
          at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
          at com.mysql.jdbc.Util.getInstance(Util.java:386)
          at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
          at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4237)
          at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4169)
          at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2617)
          at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778)
          at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2825)
          at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2156)
          at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2441)
          at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2366)
          at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2350)
          at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:147)
          at org.openmrs.util.DatabaseUtil.populateResultsFromSQLQuery(DatabaseUtil.java:138)
          ... 42 more
      

      Gliffy Diagrams

        Attachments

          Issue Links

            Activity

              People

                dkayiwa Daniel Kayiwa
                dkayiwa Daniel Kayiwa
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: