Ive been following this guys page to get Liquibase setup ( http://bytefilia.com/managing-database-schema-changes-liquibase-existing-schema/ ) with at least my base tables and data. I have successfully ran
./liquibase --driver=com.mysql.jdbc.Driver \
--classpath=lib/mysql-connector-java-5.1.34-bin.jar \
--changeLogFile="../data/database/boot.json" \
--url="jdbc:mysql://localhost/tester" \
--username=root \
--password=password \
--logLevel=debug \
generateChangeLog
I do this two times one for the table structure and one for the data.
./liquibase --driver=com.mysql.jdbc.Driver \
--classpath=lib/mysql-connector-java-5.1.34-bin.jar \
--changeLogFile="../data/database/base-data.json" \
--url="jdbc:mysql://localhost/tester" \
--username=root \
--password=password \
--logLevel=debug \
--diffTypes="data"
generateChangeLog
It generates both files boot.json & base-data.json. The files seem to be good at least comparing them to other websites and the liquibase files. The only problem that I have found is with the data file the datetime stamps generate an error about the ":" , but if I wrap them in quotes liquibase runs and syas it did it successfully. Though when I checked the database I only have 2 tables.
DATABASECHANGELOG
DATABASECHANGELOGLOCK
If I look inside DATABASECHANGELOG it has all the commits from both files after running the sync command. But it does not have any of the tables I need and of course no data. I thought maybe it wouldnt display the tables being version control and all so I tried a regular select statement.
select * from ua_auth_user;
ERROR 1146 (42S02): Table 'tester.ua_auth_user' doesn't exist
Any help is awesome. What do I need to do to get liquibase generating my schemas from a fresh database with the data that I exported. If I have done something wrong in getting the data and table structure I'll change it. I was only following the instructions to get a working example up and running before I try major development.
---Update (Following sugestions from Nathan Voxland)
I removed all tables except one table to start with. I dropped the database and create a brand new one. Then I ran the command below.
boot.json
{ "databaseChangeLog": [
{
"changeSet": {
"id": "1",
"author": "lumberjacked",
"changes": [
{
"createTable": {
"columns": [
{
"column": {
"autoIncrement": true,
"constraints": {
"constraints": {
"primaryKey": true
}
},
"name": "id",
"type": "INT"
}
},
{
"column": {
"name": "subject_category_id",
"type": "INT"
}
},
{
"column": {
"name": "subject",
"type": "VARCHAR(50)"
}
},
{
"column": {
"name": "label",
"type": "VARCHAR(50)"
}
}]
,
"tableName": "common__subjects"
}
}]
}
}
]}
Command
➜ liquibase-bin git:(test) ✗ ./liquibase
--driver=com.mysql.jdbc.Driver
--classpath=lib/mysql-connector-java-5.1.34-bin.jar
--changeLogFile="../data/database/boot.json"
--url="jdbc:mysql://localhost/tester"
--username=root
--password=password
--logLevel=debug update
Error Message
Unexpected error running Liquibase:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Incorrect
table definition; there can be only one auto column and it must be
defined as a key
SEVERE 1/18/15 4:05 PM: liquibase:
../data/database/boot.json::1::lumberjacked:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Incorrect
table definition; there can be only one auto column and it must be
defined as a key