mbucc / shmig

Database migration tool written in BASH.
BSD 3-Clause "New" or "Revised" License
458 stars 49 forks source link

Mariadb Out of range value for column #62

Open wi1w opened 4 years ago

wi1w commented 4 years ago

Hi. I'll try use shmig in docker compose with mariadb 10.3

Migrate success but I get error when tool try write migrate table

ERROR 1264 (22003) at line 4: Out of range value for column 'version' at row 1
mbucc commented 4 years ago

Thanks for the bug report!

Can you send me the insert statement triggering the range error?

It should be the current epoch seconds, which currently is 1581270578.

A MySQL signed int should hold up to 2147483647, which gives me 17 years to fix this bug. :) (https://dev.mysql.com/doc/refman/8.0/en/numeric-type-syntax.html)

mbucc commented 4 years ago

Or just post your docker compose file.

wi1w commented 4 years ago
MYSQL_DATABASE=test
MYSQL_USER=test
MYSQL_PASSWORD=1234234234hgfgh
MYSQL_ROOT_PASSWORD=gfdghfghfghgh
version: '3'

services:
  migrate:
    image: mkbucc/shmig:latest
    restart: on-failure
    command: up
    volumes:
      - ./migrations:/sql
    depends_on:
      - mariadb
    networks:
      - backend
    environment:
      DATABASE: ${MYSQL_DATABASE}
      LOGIN: ${MYSQL_USER}
      PASSWORD: ${MYSQL_PASSWORD}
      PORT: 3306
      HOST: mariadb
      TYPE: mysql
    labels:
      - "traefik.enable=false"
    logging:
      driver: "json-file"
      options:
        max-size: "50m"
        max-file: "3"

  mariadb:
    image: mariadb:10.3
    command: bash -c "chown -R mysql:mysql /var/log/mysql && exec /docker-entrypoint.sh mysqld --log-error=/var/log/mysql/err.log --slow_query_log=1 --slow_query_log_file=/var/log/mysql/slow.log --long_query_time=0.1 --general-log=1 --general-log-file=/var/log/mysql/general-log.log --character-set-server=utf8 --collation-server=utf8_general_ci"
    restart: 'always'
    volumes:
      - ./mariadb:/var/lib/mysql
      - ./logs/mysql:/var/log/mysql
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
    networks:
      - backend
    labels:
      - 'traefik.enable=false'
    logging:
      driver: "json-file"
      options:
        max-size: "50m"
        max-file: "3"

networks:
  frontend:
    external: true
  backend:
    internal: true
mbucc commented 4 years ago

Thank you. I'll take a closer look this weekend.