Permalink
Browse files

added addColumn() and renameTable(), no more todo for the moment

  • Loading branch information...
1 parent 0135554 commit a5d1a69e7529ceb5070f15802dc7508115f24e1a @thynctank committed Aug 24, 2009
Showing with 8 additions and 2 deletions.
  1. +0 −2 TODO
  2. +8 −0 storage.js
View
2 TODO
@@ -1,2 +0,0 @@
-addColumn()
-renameTable()
View
@@ -123,6 +123,10 @@ Storage.prototype = {
var sql = "DROP TABLE IF EXISTS " + name;
this.run(sql, success, failure, tx);
},
+ renameTable: function(oldName, newName, success, failure, tx) {
+ var sql = "ALTER TABLE " + oldName + " RENAME TO " + newName;
+ this.run(sql, success, failure, tx);
+ },
createIndex: function(tableName, colName, success, failure, tx) {
var sql = "CREATE INDEX IF NOT EXISTS " + tableName + "_" + colName + "_index ON " + tableName + " (" + colName + ")";
this.run(sql, success, failure, tx);
@@ -131,6 +135,10 @@ Storage.prototype = {
var sql = "DROP INDEX IF EXISTS " + tableName + "_" + colName + "_index";
this.run(sql, success, failure, tx);
},
+ addColumn: function(tableName, colName, colType, success, failure, tx) {
+ var sql = "ALTER TABLE " + tableName + " ADD COLUMN " + colName + " " + colType;
+ this.run(sql, success, failure, tx);
+ },
// conditions is obj literal with {colName: reqVal, colName: reqVal} or {colName: [comparisonOp, comparisonVal]}
read: function(table, conditions, options, success, failure, tx) {
var self = this;

0 comments on commit a5d1a69

Please sign in to comment.