Skip to content

Columns having default values not recognized by mariadb #39

@fflorent

Description

@fflorent

Describe the bug
I have a sqlite file with this table:

CREATE TABLE IF NOT EXISTS "credentials_entity" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(128) NOT NULL, "data" text NOT NULL, "type" varchar(32) NOT NULL, "nodesAccess" text NOT NULL, "createdAt" datetime(3) NOT NULL DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')), "updatedAt" datetime(3) NOT NULL DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')));

When using sqlite3-to-mysql, I get an error

Expected behaviour
I don't expect error. However, I don't have a clear idea how to fix it properly.

Actual result
I get the following error:

2022-03-29 15:41:12 ERROR    MySQL failed creating table credentials_entity: 1901 (HY000): Function or expression '`STRFTIME`()' cannot be used in the DEFAULT clause of `createdAt`
1901 (HY000): Function or expression '`STRFTIME`()' cannot be used in the DEFAULT clause of `createdAt

System Information

$ sqlite3mysql --version
| software               | version                                                                                   |
|------------------------|-------------------------------------------------------------------------------------------|
| sqlite3-to-mysql       | 1.4.14                                                                                    |
|                        |                                                                                           |
| Operating System       | Linux 4.19.0-18-amd64                                                                     |
| Python                 | CPython 3.7.3                                                                             |
| MySQL                  | mysql  Ver 15.1 Distrib 10.3.34-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2 |
| SQLite                 | 3.27.2                                                                                    |
|                        |                                                                                           |
| click                  | 8.1.0                                                                                     |
| mysql-connector-python | 8.0.28                                                                                    |
| pytimeparse            | 1.1.8                                                                                     |
| simplejson             | 3.17.6                                                                                    |
| six                    | 1.12.0                                                                                    |
| tabulate               | 0.8.9                                                                                     |
| tqdm                   | 4.63.1                                                                                    |

Additional context
Add any other context about the problem here.

In case of errors please run the same command with --debug. This option is only available on v1.4.12 or greater.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions