skip to Main Content

Deploying to Heroku and having trouble uploading an SQL export from phpMyAdmin

SQL Export Settings:

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";

Create Table

CREATE TABLE `posts` (
  `id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `title` varchar(255) NOT NULL,
  `body` text NOT NULL,
  `created_at` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

Error Message

ERROR 1067 (42000) at line 30: Invalid default value for 'created_at'

Using Step 11 from this tutorial on scotch.io

I feel like I am having issues with different versions of MySQL.

2

Answers


  1. Chosen as BEST ANSWER

    It appears that my version of CLEARDB was 5.5 and I could not get a newer version under a free account. Switched to JAWSDB and I am using a free account(I think) with 5.7

    How to update the version of the MySQL engine in ClearDB?


  2. https://dev.mysql.com/doc/refman/5.6/en/timestamp-initialization.html

    created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP. <– it is not a function so do not use ()

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search