Skip to content

Commit

Permalink
set mysql travis integration testing
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienHorgnies authored and AdrienHorgnies committed Oct 3, 2017
1 parent f5a7a5b commit 06f6ce7
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 8 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ env:
- MYSQL=$TRAVIS/templates/mysql
script:
- yarn test
after_script:
- rm -r test
- $SCRIPTS/query-mysql.sh
after_success:
Expand Down
1 change: 1 addition & 0 deletions constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const messages = {
contributeOnFailure: `Would you kindly fill an issue ? https://github.com/bastienmichaux/db-importer/issues
Also check if the issue is already being tracked before posting, would you kindly ?
"I forked, I fixed, I PR'ed" - Julius Caesar`,
goodbye: '/ᐠ。ꞈ。ᐟ\\ C U',
greeting: `/ᐠ。ꞈ。ᐟ\\ Oh hai. I'm Node-db-importer v${packageInfo.version}.
I need information before importing your db.\n`,
loadingConfig: `loading ${configFile}`,
Expand Down
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,13 @@ const closeSession = session => db.close(session)
.then(session => exportEntities(session));


const exportEntities = session => exp.exportEntities(session.entities);
const exportEntities = session => exp.exportEntities(session.entities)
.then(() => goodbye());


const goodbye = () => {
log.emphasize(msg.goodbye);
};


/**
Expand Down
11 changes: 5 additions & 6 deletions travis/scripts/query-mysql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ set -ev

mysql < "$MYSQL"/dev_life.sql

mysql 'information_schema' < "$MYSQL"/tables.sql
mysql 'information_schema' < "$MYSQL"/columns.sql
mysql 'information_schema' < "$MYSQL"/all-constraints.sql
mysql 'information_schema' < "$MYSQL"/one-to-one.sql
mysql 'information_schema' < "$MYSQL"/many-to-one.sql
mysql 'information_schema' < "$MYSQL"/many-to-many.sql
cp -t . "$MYSQL"/.db-config.json

node index

diff db-export.json "$MYSQL"/dev-life-export.json
9 changes: 9 additions & 0 deletions travis/templates/mysql/.db-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"mode": "automatic",
"dbms": "mysql",
"host": "localhost",
"port": 3306,
"user": "travis",
"password": "",
"schema": "dev_life"
}
70 changes: 70 additions & 0 deletions travis/templates/mysql/dev-life-export.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"DBBeverage": {
"DBId": {
"ordinalPosition": 1,
"columnType": "bigint(20) unsigned"
},
"DBName": {
"ordinalPosition": 2,
"columnType": "varchar(50)"
},
"DBEnergizing": {
"ordinalPosition": 3,
"columnType": "tinyint(1)"
}
},
"DBBug": {
"DBId": {
"ordinalPosition": 1,
"columnType": "bigint(20) unsigned"
},
"DBPriority": {
"ordinalPosition": 2,
"columnType": "int(11)"
},
"DBTitle": {
"ordinalPosition": 3,
"columnType": "varchar(100)"
}
},
"DBDeveloper": {
"DBId": {
"ordinalPosition": 1,
"columnType": "bigint(20) unsigned"
},
"DBFirstname": {
"ordinalPosition": 2,
"columnType": "varchar(50)"
},
"DBLastName": {
"ordinalPosition": 3,
"columnType": "varchar(100)"
},
"DBBirthDate": {
"ordinalPosition": 4,
"columnType": "date"
},
"DBFKBeverage": {
"ordinalPosition": 5,
"columnType": "bigint(20) unsigned"
}
},
"DBMug": {
"DBId": {
"ordinalPosition": 1,
"columnType": "bigint(20) unsigned"
},
"DBAppearance": {
"ordinalPosition": 2,
"columnType": "varchar(500)"
},
"DBCapacity": {
"ordinalPosition": 3,
"columnType": "float"
},
"DBFKDeveloper": {
"ordinalPosition": 4,
"columnType": "bigint(20) unsigned"
}
}
}

0 comments on commit 06f6ce7

Please sign in to comment.