Created
September 15, 2009 03:51
-
-
Save brandon-beacher/187101 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env narwhal | |
| require("browser"); | |
| var dirname = require("file").path(module.path).dirname(); | |
| load(dirname + "/../lib/couch.js"); | |
| var db = new CouchDB(); | |
| db.uri = "http://localhost:5984/dfc/"; | |
| var url = "jdbc:mysql://localhost/dfc_development?user=root"; | |
| var connection = Packages.com.mysql.jdbc.Driver().connect(url, null); | |
| var customers = connection.createStatement().executeQuery("select * from customers order by layout"); | |
| while (customers.next()) { | |
| var customer = {}; | |
| customer._id = java.util.UUID.randomUUID().toString(); | |
| customer.type = "Customer"; | |
| customer.layout = customers.getString("layout"); | |
| db.save(customer); | |
| } | |
| customers.close(); | |
| connection.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment