vendredi 13 mars 2015

convert MySQL table definitions to SQLite

Are there any good resources for converting table definitions from MySQL to SQLite? I already iterated through the MySQL dump file and exported all the table data into CSVs, so now I just need to create the tables and insert the data. (Hopefully it'll be that simple, at least...) For example:



CREATE TABLE `tablename` (
`field1` varchar(255) NOT NULL,
`field2` tinyint(3) unsigned NOT NULL,
`field3` float(12,2) default NULL,
`field4` char(5) default NULL,
`field5` bit(1) default b'0',
`field6` smallint(6) NOT NULL,
`field7` int(10) default NULL,
`field8` double default NULL,
PRIMARY KEY (`pkey`),
UNIQUE KEY (`ukey`),
KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


I'm guessing the decimal rules in parenthesis would just get chopped off ("float(12,2)" => "float"), or would it go to decimal, based on the types in SQLite? And engine stuff would be left off, it seems. (For the record, I didn't set up the table and cannot change the behaviors of it, only convert it to SQLite.)


Aucun commentaire:

Enregistrer un commentaire