Convert MySQL script to H2

Here is a good instruction by Matthew Casperson

Exporting from MySQL to H2

Here is a short list of steps, to convert from mysql to h2:

Fix up single quotes

CREATE TABLE `user` ( `name` varchar(20) NOT NULL,
convert to
CREATE TABLE user ( name varchar(20) NOT NULL,

Fix up hex numbers
Fix up bits
Don't include ranges in keys
Remove character sets (remove CHARACTER SET ...)
Remove COLLATE settings (f.e. COLLATE utf8_unicode_ci)
Remove indexes on BLOBS, CLOBS and TEXT fields
Make all index names unique
Use the MySQL compatibility mode (jdbc:h2:~/test;MODE=MySQL)


There are a number of database tools that help migrating data from one to another database, for example:

  • Flyway
  • SQuirreL DB Copy Plugin

Tags:

Mysql

Sql

H2