Permalink
Browse files

Updated the system to use the new version of node-mysql (via npm) and…

… cleaned up a bit of the code.
  • Loading branch information...
rsandor committed Jan 20, 2011
1 parent 20403dd commit 3b98b6ee7f1e8dd3a79dd5c543e5c853f0dfdb29
Showing with 249 additions and 250 deletions.
  1. +10 −19 README
  2. +10 −19 README.markdown
  3. +10 −17 config.js
  4. +35 −0 config.js.mine
  5. +184 −195 migrate.js
View
29 README
@@ -5,16 +5,15 @@ By Ryan Sandor Richards
Introduction
--------------------------------------------------------------------------------
-Migrate is a tool for Node.js applications that allows for the programmatic
-definition of database schema changes. It borrows very heavily from the Rails
-migration system and contains many of the same features. If you are unfamiliar
-with how migrations work don't fret, just read on and everything will be
-explained!
+Migrate is a tool that allows you to define database schema migrations with
+javascript. It borrows very heavily from the ruby migration system and contains
+many of the same features. If you are unfamiliar with how migrations work don't
+fret, just read on and everything will be explained!
Requirements
--------------------------------------------------------------------------------
1. Node.js - http://github.com/ry/node
-2. node-mysql - http://github.com/masuidrive/node-mysql
+2. node-mysql - https://github.com/felixge/node-mysql
Please note that at the current time we only support MySQL but other DBMS' are
on their way (next up: Postgres).
@@ -31,20 +30,13 @@ the directory where the migrate.js file resides.
The configuration file has the following keys:
-* `node_mysql_path` - This is the path to the node-mysql module (specifically
- the "mysql.js" file provided by the library). This path is relative to the
- directory in which you have installed node-migrate. Here is an example:
- `node_mysql_path = '../node-mysql/lib/mysql.js` (note the `.js` is optional).
-* `host_name` - Host name where your database resides (in most cases this will
- be `localhost`).
-* `port` - Port your database server is running on (keep null for default port).
-* `user_name` - Username for accessing the database server.
-* `password` - Password for accessing the database server.
-* `db_name` - Name of the database you are using.
* `dbms` - The database management system to use (currently we only support a
a value of `'mysql'`).
* `migration_path` - Relative path to the directory in which migrations are
stored.
+* `mysql` - Just a simple client configuration for mysql. Fill out your username,
+ password, and any other information needed to connect to the database via
+ node-mysql's `Client` class.
How do I use migrate?
--------------------------------------------------------------------------------
@@ -266,9 +258,8 @@ Producing SQL:
Outtro
--------------------------------------------------------------------------------
So that about sums it up. Simple and easy ;). It's a very early alpha version so
-please don't hate on only having MySQL support! Things should be progressing
-super rapidly, so keep an eye out. If you have a feature request feel free to
-send me a message and I'll try to get it in ASAP.
+please don't hate on only having MySQL support! If you have a feature request
+feel free to send me a message and I'll try to get it in ASAP.
Thanks!
View
@@ -5,16 +5,15 @@ By Ryan Sandor Richards
Introduction
--------------------------------------------------------------------------------
-Migrate is a tool for Node.js applications that allows for the programmatic
-definition of database schema changes. It borrows very heavily from the Rails
-migration system and contains many of the same features. If you are unfamiliar
-with how migrations work don't fret, just read on and everything will be
-explained!
+Migrate is a tool that allows you to define database schema migrations with
+javascript. It borrows very heavily from the ruby migration system and contains
+many of the same features. If you are unfamiliar with how migrations work don't
+fret, just read on and everything will be explained!
Requirements
--------------------------------------------------------------------------------
1. Node.js - http://github.com/ry/node
-2. node-mysql - http://github.com/masuidrive/node-mysql
+2. node-mysql - https://github.com/felixge/node-mysql
Please note that at the current time we only support MySQL but other DBMS' are
on their way (next up: Postgres).
@@ -31,20 +30,13 @@ the directory where the migrate.js file resides.
The configuration file has the following keys:
-* `node_mysql_path` - This is the path to the node-mysql module (specifically
- the "mysql.js" file provided by the library). This path is relative to the
- directory in which you have installed node-migrate. Here is an example:
- `node_mysql_path = '../node-mysql/lib/mysql.js` (note the `.js` is optional).
-* `host_name` - Host name where your database resides (in most cases this will
- be `localhost`).
-* `port` - Port your database server is running on (keep null for default port).
-* `user_name` - Username for accessing the database server.
-* `password` - Password for accessing the database server.
-* `db_name` - Name of the database you are using.
* `dbms` - The database management system to use (currently we only support a
a value of `'mysql'`).
* `migration_path` - Relative path to the directory in which migrations are
stored.
+* `mysql` - Just a simple client configuration for mysql. Fill out your username,
+ password, and any other information needed to connect to the database via
+ node-mysql's `Client` class.
How do I use migrate?
--------------------------------------------------------------------------------
@@ -266,9 +258,8 @@ Producing SQL:
Outtro
--------------------------------------------------------------------------------
So that about sums it up. Simple and easy ;). It's a very early alpha version so
-please don't hate on only having MySQL support! Things should be progressing
-super rapidly, so keep an eye out. If you have a feature request feel free to
-send me a message and I'll try to get it in ASAP.
+please don't hate on only having MySQL support! If you have a feature request
+feel free to send me a message and I'll try to get it in ASAP.
Thanks!
View
@@ -1,6 +1,6 @@
/*
* migrate.js - A database agnostic migration system for Node.js.
- * Copyright (c) 2010 Ryan Sandor Richards
+ * Copyright (c) 2010 - 2011 Ryan Sandor Richards
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -20,23 +20,16 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
-
-// Path to the node-mysql library (relative to migrate)
-// Example: exports.node_mysql_path = '../node-mysql/lib/mysql';
-exports.node_mysql_path = '';
-// Host and port
-exports.host_name = 'localhost';
-exports.port = null;
-
-// User and DB information
-exports.user_name = '';
-exports.password = '';
-exports.db_name = '';
+// Path to the migrations directory (relative to migrate)
+exports.migration_path = './migrations/';
-// Currently we only support MySQL, but in the future you
-// can set which DBMS to use here:
+// Which DBMS to use for executing migrations
exports.dbms = 'mysql';
-// Path to the migrations directory (relative to migrate)
-exports.migration_path = ''
+// Configuration for MySQL (username, password, etc.)
+exports.mysql = {
+ user: '',
+ password: '',
+ database: ''
+};
View
@@ -0,0 +1,35 @@
+/*
+ * migrate.js - A database agnostic migration system for Node.js.
+ * Copyright (c) 2010 Ryan Sandor Richards
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+// Path to the migrations directory (relative to migrate)
+exports.migration_path = './migrations/';
+
+// Which DBMS to use for executing migrations.
+exports.dbms = 'mysql';
+
+// Configuration for MySQL
+exports.mysql = {
+ user: 'migration',
+ password: 'ioioio',
+ database: 'migration_test'
+};
Oops, something went wrong.

0 comments on commit 3b98b6e

Please sign in to comment.