Class Index | File Index

Classes


Class nimbusly.Migration


Defined in: database.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
nimbusly.Migration(version, sql)
A simple class for storing migrations.
Class Detail
nimbusly.Migration(version, sql)
A simple class for storing migrations. A migration object holds the SQL needed to upgrade the database from one version to the next. An array of migrations is passed to the database when it is opened, and defined the order in which the versions come. This way, if you upgrade the software on the server,users with older versions will have their local databases automatically updated to the new database schema, regardless of what version they are on. The version numbers should normally start at one for the first version, and increment with each specific database change released. For example: var migrations = [ nimbusly.Migration(1, "CREATE TABLE users (id REAL UNIQUE, name TEXT, password TEXT)"), nimbusly.Migration(2, "ALTER TABLE users ADD COLUMN email TEXT"), nimbusly.Migration(3, [ "CREATE TABLE user_emails (id REAL UNIQUE, user_id REAL, name TEXT, email TEXT"), "INSERT INTO user_mails (id, user_id, name, email) SELECT id, id, 'main', email FROM users", ]
Parameters:
{Number} version
version of the database this migration will upgrade to
{String|String[]|String[][]} sql
one or more sql statements to migrate the database
See:
nimbusly.Database

Documentation generated by JsDoc Toolkit 2.3.2 on Sun May 09 2010 09:58:04 GMT-0400 (EDT)