Comparing version 0.4.4 to 0.4.5
@@ -19,2 +19,4 @@ // Grammar | ||
var push = [].push; | ||
// The list of different components | ||
@@ -35,2 +37,17 @@ var components = [ | ||
// Gets the cleaned bindings. | ||
getBindings: function(builder) { | ||
var bindings = builder.bindings; | ||
var cleaned = []; | ||
for (var i = 0, l = bindings.length; i < l; i++) { | ||
// if (bindings[i] == void 0) continue; | ||
if (!bindings[i] || bindings[i]._source !== 'Raw') { | ||
cleaned.push(bindings[i]); | ||
} else { | ||
push.apply(cleaned, bindings[i].bindings); | ||
} | ||
} | ||
return cleaned; | ||
}, | ||
// Compiles the `select` statement, or nested sub-selects | ||
@@ -37,0 +54,0 @@ // by calling each of the component compilers, trimming out |
@@ -20,4 +20,4 @@ // SchemaGrammar | ||
var Helpers = require('../../lib/helpers').Helpers; | ||
var Raw = require('../../lib/raw').Raw; | ||
var Helpers = require('../../lib/helpers').Helpers; | ||
var Raw = require('../../lib/raw').Raw; | ||
@@ -32,2 +32,6 @@ exports.baseSchemaGrammar = { | ||
// Clone the builder, before we go about working with the columns & commands. | ||
// TODO: Clean this up. | ||
builder = builder.clone(); | ||
// Add the commands that are implied by the blueprint. | ||
@@ -34,0 +38,0 @@ if (builder.columns.length > 0 && !builder.creating()) { |
@@ -19,2 +19,8 @@ // SQLite3 SchemaGrammar | ||
// Returns the cleaned bindings for the current query. | ||
getBindings: function(builder) { | ||
if (builder.type === 'columnExists') return []; | ||
return grammar.getBindings(builder); | ||
}, | ||
// Compile the query to determine if a table exists. | ||
@@ -26,11 +32,10 @@ compileTableExists: function() { | ||
// Compile the query to determine if a column exists. | ||
compileColumnExists: function(blueprint) { | ||
blueprint.bindings = []; | ||
return "PRAGMA table_info(" + this.wrapTable(blueprint) + ")"; | ||
compileColumnExists: function(builder) { | ||
return "PRAGMA table_info(" + this.wrapTable(builder) + ")"; | ||
}, | ||
// Compile a create table command. | ||
compileCreateTable: function(blueprint) { | ||
var columns = this.getColumns(blueprint).join(', '); | ||
var sql = 'create table ' + this.wrapTable(blueprint) + ' (' + columns; | ||
compileCreateTable: function(builder) { | ||
var columns = this.getColumns(builder).join(', '); | ||
var sql = 'create table ' + this.wrapTable(builder) + ' (' + columns; | ||
@@ -40,4 +45,4 @@ // SQLite forces primary keys to be added when the table is initially created | ||
// to the table's declaration here so they can be created on the tables. | ||
sql += this.addForeignKeys(blueprint); | ||
sql += this.addPrimaryKeys(blueprint) || ''; | ||
sql += this.addForeignKeys(builder); | ||
sql += this.addPrimaryKeys(builder) || ''; | ||
sql +=')'; | ||
@@ -52,5 +57,5 @@ | ||
// are building, since SQLite needs foreign keys on the tables creation. | ||
addForeignKeys: function(blueprint) { | ||
addForeignKeys: function(builder) { | ||
var sql = ''; | ||
var commands = this.getCommandsByName(blueprint, 'foreign'); | ||
var commands = this.getCommandsByName(builder, 'foreign'); | ||
for (var i = 0, l = commands.length; i < l; i++) { | ||
@@ -67,4 +72,4 @@ var command = commands[i]; | ||
// Get the primary key syntax for a table creation statement. | ||
addPrimaryKeys: function(blueprint) { | ||
var primary = this.getCommandByName(blueprint, 'primary'); | ||
addPrimaryKeys: function(builder) { | ||
var primary = this.getCommandByName(builder, 'primary'); | ||
if (primary) { | ||
@@ -85,5 +90,5 @@ // Ensure that autoincrement columns aren't handled here, this is handled | ||
// Compile alter table commands for adding columns | ||
compileAdd: function(blueprint) { | ||
var table = this.wrapTable(blueprint); | ||
var columns = this.prefixArray('add column', this.getColumns(blueprint)); | ||
compileAdd: function(builder) { | ||
var table = this.wrapTable(builder); | ||
var columns = this.prefixArray('add column', this.getColumns(builder)); | ||
var statements = []; | ||
@@ -97,5 +102,5 @@ for (var i = 0, l = columns.length; i < l; i++) { | ||
// Compile a unique key command. | ||
compileUnique: function(blueprint, command) { | ||
compileUnique: function(builder, command) { | ||
var columns = this.columnize(command.columns); | ||
var table = this.wrapTable(blueprint); | ||
var table = this.wrapTable(builder); | ||
return 'create unique index ' + command.index + ' on ' + table + ' (' + columns + ')'; | ||
@@ -105,5 +110,5 @@ }, | ||
// Compile a plain index key command. | ||
compileIndex: function(blueprint, command) { | ||
compileIndex: function(builder, command) { | ||
var columns = this.columnize(command.columns); | ||
var table = this.wrapTable(blueprint); | ||
var table = this.wrapTable(builder); | ||
return 'create index ' + command.index + ' on ' + table + ' (' + columns + ')'; | ||
@@ -123,3 +128,3 @@ }, | ||
// Compile a drop unique key command. | ||
compileDropUnique: function(blueprint, command) { | ||
compileDropUnique: function(builder, command) { | ||
return 'drop index ' + command.index; | ||
@@ -129,8 +134,8 @@ }, | ||
// Compile a rename table command. | ||
compileRenameTable: function(blueprint, command) { | ||
return 'alter table ' + this.wrapTable(blueprint) + ' rename to ' + this.wrapTable(command.to); | ||
compileRenameTable: function(builder, command) { | ||
return 'alter table ' + this.wrapTable(builder) + ' rename to ' + this.wrapTable(command.to); | ||
}, | ||
// Compile a rename column command. | ||
compileRenameColumn: function(blueprint, command) { | ||
compileRenameColumn: function(builder, command) { | ||
return '__rename_column__'; | ||
@@ -175,3 +180,3 @@ }, | ||
// Get the SQL for an auto-increment column modifier. | ||
modifyIncrement: function(blueprint, column) { | ||
modifyIncrement: function(builder, column) { | ||
if (column.autoIncrement && (column.type == 'integer' || column.type == 'bigInteger')) { | ||
@@ -178,0 +183,0 @@ return ' primary key autoincrement not null'; |
@@ -29,3 +29,3 @@ // ServerBase | ||
initPool: function(poolConfig) { | ||
this.pool = new Pool(_.extend({}, poolConfig, _.result(this, 'poolDefaults')), this); | ||
this.pool = new Pool(_.extend({}, _.result(this, 'poolDefaults'), poolConfig), this); | ||
}, | ||
@@ -61,3 +61,7 @@ | ||
return chain.then(builder.handleResponse); | ||
return chain.then(builder.handleResponse).otherwise(function(e) { | ||
var err = new Error(e.toString() + ' - ' + '{sql: ' + sql + ', bindings: ' + bindings + '}'); | ||
err.originalStack = e.stack; | ||
throw err; | ||
}); | ||
}, | ||
@@ -64,0 +68,0 @@ |
@@ -13,6 +13,16 @@ // MySQL SchemaGrammar | ||
// Dialect specific `getBindings`. | ||
getBindings: function(builder) { | ||
var bindings = grammar.getBindings(builder); | ||
if (builder.type === 'tableExists') { | ||
bindings.unshift(builder.client.connectionSettings.database); | ||
} | ||
return bindings; | ||
}, | ||
// Ensures the response is returned in the same format as other clients. | ||
handleResponse: function(builder, resp) { | ||
if (builder.type === 'tableExists') return resp.length > 0; | ||
if (builder.type === 'columnExists') return resp.length > 0; | ||
resp = resp[0]; | ||
if (builder.type === 'tableExists') return resp[0].length > 0; | ||
if (builder.type === 'columnExists') return resp[0].length > 0; | ||
return resp; | ||
@@ -22,14 +32,14 @@ }, | ||
// Compile a create table command. | ||
compileCreateTable: function(blueprint, command) { | ||
var sql = baseSchemaGrammar.compileCreateTable.call(this, blueprint, command); | ||
var conn = blueprint.client.connectionSettings; | ||
compileCreateTable: function(builder, command) { | ||
var sql = baseSchemaGrammar.compileCreateTable.call(this, builder, command); | ||
var conn = builder.client.connectionSettings; | ||
if (conn.charset) sql += ' default character set ' + conn.charset; | ||
if (conn.collation) sql += ' collate ' + conn.collation; | ||
if (blueprint.flags.engine) { | ||
sql += ' engine = ' + blueprint.flags.engine; | ||
if (builder.flags.engine) { | ||
sql += ' engine = ' + builder.flags.engine; | ||
} | ||
// Checks if the table is commented | ||
var isCommented = this.getCommandByName(blueprint, 'comment'); | ||
var isCommented = this.getCommandByName(builder, 'comment'); | ||
@@ -46,4 +56,3 @@ // TODO: Handle max comment length. | ||
// Compile the query to determine if a table exists. | ||
compileTableExists: function(blueprint) { | ||
blueprint.bindings.unshift(blueprint.client.connectionSettings.database); | ||
compileTableExists: function(builder) { | ||
return 'select * from information_schema.tables where table_schema = ? and table_name = ?'; | ||
@@ -53,31 +62,31 @@ }, | ||
// Compile a query to determine if a column exists. | ||
compileColumnExists: function(blueprint) { | ||
return 'show columns from ' + this.wrapTable(blueprint) + ' like ?'; | ||
compileColumnExists: function(builder) { | ||
return 'show columns from ' + this.wrapTable(builder) + ' like ?'; | ||
}, | ||
// Compile an add command. | ||
compileAdd: function(blueprint) { | ||
var columns = this.prefixArray('add', this.getColumns(blueprint)); | ||
return 'alter table ' + this.wrapTable(blueprint) + ' ' + columns.join(', '); | ||
compileAdd: function(builder) { | ||
var columns = this.prefixArray('add', this.getColumns(builder)); | ||
return 'alter table ' + this.wrapTable(builder) + ' ' + columns.join(', '); | ||
}, | ||
// Compile a primary key command. | ||
compilePrimary: function(blueprint, command) { | ||
return this.compileKey(blueprint, command, 'primary key'); | ||
compilePrimary: function(builder, command) { | ||
return this.compileKey(builder, command, 'primary key'); | ||
}, | ||
// Compile a unique key command. | ||
compileUnique: function(blueprint, command) { | ||
return this.compileKey(blueprint, command, 'unique'); | ||
compileUnique: function(builder, command) { | ||
return this.compileKey(builder, command, 'unique'); | ||
}, | ||
// Compile a plain index key command. | ||
compileIndex: function(blueprint, command) { | ||
return this.compileKey(blueprint, command, 'index'); | ||
compileIndex: function(builder, command) { | ||
return this.compileKey(builder, command, 'index'); | ||
}, | ||
// Compile an index creation command. | ||
compileKey: function(blueprint, command, type) { | ||
compileKey: function(builder, command, type) { | ||
var columns = this.columnize(command.columns); | ||
var table = this.wrapTable(blueprint); | ||
var table = this.wrapTable(builder); | ||
return 'alter table ' + table + " add " + type + " " + command.index + "(" + columns + ")"; | ||
@@ -87,35 +96,35 @@ }, | ||
// Compile a drop column command. | ||
compileDropColumn: function(blueprint, command) { | ||
compileDropColumn: function(builder, command) { | ||
var columns = this.prefixArray('drop', this.wrapArray(command.columns)); | ||
return 'alter table ' + this.wrapTable(blueprint) + ' ' + columns.join(', '); | ||
return 'alter table ' + this.wrapTable(builder) + ' ' + columns.join(', '); | ||
}, | ||
// Compile a drop primary key command. | ||
compileDropPrimary: function(blueprint) { | ||
return 'alter table ' + this.wrapTable(blueprint) + ' drop primary key'; | ||
compileDropPrimary: function(builder) { | ||
return 'alter table ' + this.wrapTable(builder) + ' drop primary key'; | ||
}, | ||
// Compile a drop unique key command. | ||
compileDropUnique: function(blueprint, command) { | ||
return this.compileDropIndex(blueprint, command); | ||
compileDropUnique: function(builder, command) { | ||
return this.compileDropIndex(builder, command); | ||
}, | ||
// Compile a drop index command. | ||
compileDropIndex: function(blueprint, command) { | ||
return 'alter table ' + this.wrapTable(blueprint) + ' drop index ' + command.index; | ||
compileDropIndex: function(builder, command) { | ||
return 'alter table ' + this.wrapTable(builder) + ' drop index ' + command.index; | ||
}, | ||
// Compile a drop foreign key command. | ||
compileDropForeign: function(blueprint, command) { | ||
return 'alter table ' + this.wrapTable(blueprint) + " drop foreign key " + command.index; | ||
compileDropForeign: function(builder, command) { | ||
return 'alter table ' + this.wrapTable(builder) + " drop foreign key " + command.index; | ||
}, | ||
// Compile a rename table command. | ||
compileRenameTable: function(blueprint, command) { | ||
return 'rename table ' + this.wrapTable(blueprint) + ' to ' + this.wrapTable(command.to); | ||
compileRenameTable: function(builder, command) { | ||
return 'rename table ' + this.wrapTable(builder) + ' to ' + this.wrapTable(command.to); | ||
}, | ||
// Compile a rename column command. | ||
compileRenameColumn: function(blueprint, command) { | ||
return 'alter table ' + this.wrapTable(blueprint) + ' change ' + | ||
compileRenameColumn: function(builder, command) { | ||
return 'alter table ' + this.wrapTable(builder) + ' change ' + | ||
this.wrapTable(command.from) + ' ' + this.wrapTable(command.to) + ' __datatype__'; | ||
@@ -125,3 +134,3 @@ }, | ||
// Compiles the comment on the table. | ||
compileComment: function(blueprint, command) { | ||
compileComment: function(builder, command) { | ||
// Handled on create table... | ||
@@ -190,3 +199,3 @@ }, | ||
// Get the SQL for an unsigned column modifier. | ||
modifyUnsigned: function(blueprint, column) { | ||
modifyUnsigned: function(builder, column) { | ||
if (column.isUnsigned) return ' unsigned'; | ||
@@ -196,3 +205,3 @@ }, | ||
// Get the SQL for a default column modifier. | ||
modifyDefault: function(blueprint, column) { | ||
modifyDefault: function(builder, column) { | ||
// TODO - no default on blob/text | ||
@@ -205,3 +214,3 @@ if (column.defaultValue != void 0 && column.type != 'blob' && column.type.indexOf('text') === -1) { | ||
// Get the SQL for an auto-increment column modifier. | ||
modifyIncrement: function(blueprint, column) { | ||
modifyIncrement: function(builder, column) { | ||
if (column.autoIncrement && (column.type == 'integer' || column.type == 'bigInteger')) { | ||
@@ -213,3 +222,3 @@ return ' not null auto_increment primary key'; | ||
// Get the SQL for an "after" column modifier. | ||
modifyAfter: function(blueprint, column) { | ||
modifyAfter: function(builder, column) { | ||
if (column.isAfter) { | ||
@@ -221,3 +230,3 @@ return ' after ' + this.wrap(column.isAfter); | ||
// Get the SQL for a comment column modifier. | ||
modifyComment: function(blueprint, column) { | ||
modifyComment: function(builder, column) { | ||
// TODO: Look into limiting this length. | ||
@@ -224,0 +233,0 @@ var maxColumnCommentLength = 255; |
@@ -33,5 +33,5 @@ // PostgreSQL SchemaGrammar | ||
// Compile a create table command. | ||
compileAdd: function(blueprint) { | ||
var table = this.wrapTable(blueprint); | ||
var columns = this.prefixArray('add column', this.getColumns(blueprint)); | ||
compileAdd: function(builder) { | ||
var table = this.wrapTable(builder); | ||
var columns = this.prefixArray('add column', this.getColumns(builder)); | ||
return 'alter table ' + table + ' ' + columns.join(', '); | ||
@@ -41,10 +41,10 @@ }, | ||
// Compile a primary key command. | ||
compilePrimary: function(blueprint, command) { | ||
compilePrimary: function(builder, command) { | ||
var columns = this.columnize(command.columns); | ||
return 'alter table ' + this.wrapTable(blueprint) + " add primary key (" + columns + ")"; | ||
return 'alter table ' + this.wrapTable(builder) + " add primary key (" + columns + ")"; | ||
}, | ||
// Compile a unique key command. | ||
compileUnique: function(blueprint, command) { | ||
var table = this.wrapTable(blueprint); | ||
compileUnique: function(builder, command) { | ||
var table = this.wrapTable(builder); | ||
var columns = this.columnize(command.columns); | ||
@@ -55,11 +55,11 @@ return 'alter table ' + table + ' add constraint ' + command.index + ' unique (' + columns + ')'; | ||
// Compile a plain index key command. | ||
compileIndex: function(blueprint, command) { | ||
compileIndex: function(builder, command) { | ||
var columns = this.columnize(command.columns); | ||
return "create index " + command.index + " on " + this.wrapTable(blueprint) + ' (' + columns + ')'; | ||
return "create index " + command.index + " on " + this.wrapTable(builder) + ' (' + columns + ')'; | ||
}, | ||
// Compile a drop column command. | ||
compileDropColumn: function(blueprint, command) { | ||
compileDropColumn: function(builder, command) { | ||
var columns = this.prefixArray('drop column', this.wrapArray(command.columns)); | ||
var table = this.wrapTable(blueprint); | ||
var table = this.wrapTable(builder); | ||
return 'alter table ' + table + ' ' + columns.join(', '); | ||
@@ -69,10 +69,10 @@ }, | ||
// Compile a drop primary key command. | ||
compileDropPrimary: function(blueprint) { | ||
var table = blueprint.getTable(); | ||
return 'alter table ' + this.wrapTable(blueprint) + " drop constraint " + table + "_pkey"; | ||
compileDropPrimary: function(builder) { | ||
var table = builder.getTable(); | ||
return 'alter table ' + this.wrapTable(builder) + " drop constraint " + table + "_pkey"; | ||
}, | ||
// Compile a drop unique key command. | ||
compileDropUnique: function(blueprint, command) { | ||
var table = this.wrapTable(blueprint); | ||
compileDropUnique: function(builder, command) { | ||
var table = this.wrapTable(builder); | ||
return "alter table " + table + " drop constraint " + command.index; | ||
@@ -82,4 +82,4 @@ }, | ||
// Compile a drop foreign key command. | ||
compileDropForeign: function(blueprint, command) { | ||
var table = this.wrapTable(blueprint); | ||
compileDropForeign: function(builder, command) { | ||
var table = this.wrapTable(builder); | ||
return "alter table " + table + " drop constraint " + command.index; | ||
@@ -89,16 +89,16 @@ }, | ||
// Compile a rename table command. | ||
compileRenameTable: function(blueprint, command) { | ||
return 'alter table ' + this.wrapTable(blueprint) + ' rename to ' + this.wrapTable(command.to); | ||
compileRenameTable: function(builder, command) { | ||
return 'alter table ' + this.wrapTable(builder) + ' rename to ' + this.wrapTable(command.to); | ||
}, | ||
// Compile a rename column command. | ||
compileRenameColumn: function(blueprint, command) { | ||
return 'alter table ' + this.wrapTable(blueprint) + ' rename '+ this.wrapTable(command.from) + ' to ' + this.wrapTable(command.to); | ||
compileRenameColumn: function(builder, command) { | ||
return 'alter table ' + this.wrapTable(builder) + ' rename '+ this.wrapTable(command.from) + ' to ' + this.wrapTable(command.to); | ||
}, | ||
// Compile a comment command. | ||
compileComment: function(blueprint, command) { | ||
compileComment: function(builder, command) { | ||
var sql = ''; | ||
if (command.comment) { | ||
sql += 'comment on table ' + this.wrapTable(blueprint) + ' is ' + "'" + command.comment + "'"; | ||
sql += 'comment on table ' + this.wrapTable(builder) + ' is ' + "'" + command.comment + "'"; | ||
} | ||
@@ -109,6 +109,6 @@ return sql; | ||
// Compile any additional postgres specific items. | ||
compileAdditional: function(blueprint, command) { | ||
return _.compact(_.map(blueprint.columns, function(column) { | ||
compileAdditional: function(builder, command) { | ||
return _.compact(_.map(builder.columns, function(column) { | ||
if (column.isCommented && _.isString(column.isCommented)) { | ||
return 'comment on column ' + this.wrapTable(blueprint) + '.' + this.wrap(column.name) + " is '" + column.isCommented + "'"; | ||
return 'comment on column ' + this.wrapTable(builder) + '.' + this.wrap(column.name) + " is '" + column.isCommented + "'"; | ||
} | ||
@@ -177,4 +177,4 @@ }, this)); | ||
// back to "text" if it's not. | ||
typeJson: function(column, blueprint) { | ||
if (parseFloat(blueprint.client.version) >= 9.2) return 'json'; | ||
typeJson: function(column, builder) { | ||
if (parseFloat(builder.client.version) >= 9.2) return 'json'; | ||
return 'text'; | ||
@@ -184,3 +184,3 @@ }, | ||
// Get the SQL for an auto-increment column modifier. | ||
modifyIncrement: function(blueprint, column) { | ||
modifyIncrement: function(builder, column) { | ||
if (column.autoIncrement && (column.type == 'integer' || column.type == 'bigInteger')) { | ||
@@ -187,0 +187,0 @@ return ' primary key not null'; |
@@ -1,2 +0,2 @@ | ||
// Knex.js 0.4.4 | ||
// Knex.js 0.4.5 | ||
// -------------- | ||
@@ -94,3 +94,3 @@ | ||
// Keep in sync with package.json | ||
knex.VERSION = '0.4.4'; | ||
knex.VERSION = '0.4.5'; | ||
@@ -97,0 +97,0 @@ // Runs a new transaction, taking a container and returning a promise |
@@ -116,13 +116,3 @@ // Common | ||
getBindings: function() { | ||
var bindings = this.bindings; | ||
var cleaned = []; | ||
for (var i = 0, l = bindings.length; i < l; i++) { | ||
// if (bindings[i] == void 0) continue; | ||
if (!bindings[i] || bindings[i]._source !== 'Raw') { | ||
cleaned.push(bindings[i]); | ||
} else { | ||
push.apply(cleaned, bindings[i].bindings); | ||
} | ||
} | ||
return cleaned; | ||
return this.grammar.getBindings(this); | ||
}, | ||
@@ -129,0 +119,0 @@ |
@@ -10,4 +10,5 @@ // Raw | ||
var _ = require('underscore'); | ||
var Common = require('./common').Common; | ||
var Common = require('./common').Common; | ||
var Raw = function(instance) { | ||
@@ -35,2 +36,7 @@ this.knex = instance; | ||
return this.sql; | ||
}, | ||
// Returns the cleaned bindings for the current raw query. | ||
getBindings: function() { | ||
return this.client.grammar.getBindings(this); | ||
} | ||
@@ -37,0 +43,0 @@ |
@@ -25,3 +25,3 @@ // Schema Builder | ||
var toClone = ['columns', 'commands', 'bindings']; | ||
var toClone = ['columns', 'commands', 'bindings', 'flags']; | ||
@@ -28,0 +28,0 @@ _.extend(SchemaBuilder.prototype, Common, { |
{ | ||
"name": "knex", | ||
"version": "0.4.4", | ||
"version": "0.4.5", | ||
"description": "A query builder for Postgres, MySQL and SQLite3, designed to be flexible, portable, and fun to use.", | ||
@@ -5,0 +5,0 @@ "main": "knex.js", |
@@ -26,3 +26,3 @@ var when = require('when'); | ||
table.bigIncrements('id'); | ||
table.string('first_name'); | ||
table.string('first_name').index(); | ||
table.string('last_name'); | ||
@@ -33,3 +33,3 @@ table.string('email').unique().nullable(); | ||
table.timestamps(); | ||
}).logMe('sql'); | ||
}).logMe('sql').then(null); | ||
}); | ||
@@ -99,2 +99,8 @@ | ||
it('should be false if a table does not exists', function() { | ||
return knex.schema.hasTable('this_table_is_fake').then(function(resp) { | ||
expect(resp).to.be.false; | ||
}); | ||
}); | ||
}); | ||
@@ -101,0 +107,0 @@ |
@@ -19,11 +19,11 @@ module.exports = { | ||
bindings: [], | ||
sql: ['create table `test_table_one` (`id` bigint unsigned not null auto_increment primary key, `first_name` varchar(255), `last_name` varchar(255), `email` varchar(255), `logins` int(11) default \'1\', `about` text comment \'A comment.\', `created_at` datetime, `updated_at` datetime) default character set utf8 engine = InnoDB comment = \'A table comment.\'','alter table `test_table_one` add unique test_table_one_email_unique(`email`)','alter table `test_table_one` add index test_table_one_logins_index(`logins`)','alter table `test_table_one` add unique test_table_one_email_unique(`email`)','alter table `test_table_one` add index test_table_one_logins_index(`logins`)'] | ||
sql: ['create table `test_table_one` (`id` bigint unsigned not null auto_increment primary key, `first_name` varchar(255), `last_name` varchar(255), `email` varchar(255), `logins` int(11) default \'1\', `about` text comment \'A comment.\', `created_at` datetime, `updated_at` datetime) default character set utf8 engine = InnoDB comment = \'A table comment.\'','alter table `test_table_one` add index test_table_one_first_name_index(`first_name`)','alter table `test_table_one` add unique test_table_one_email_unique(`email`)','alter table `test_table_one` add index test_table_one_logins_index(`logins`)'] | ||
}, | ||
postgresql: { | ||
bindings: [], | ||
sql: ['create table "test_table_one" ("id" serial primary key not null, "first_name" varchar(255), "last_name" varchar(255), "email" varchar(255), "logins" integer default \'1\', "about" text, "created_at" timestamp, "updated_at" timestamp)','comment on table "test_table_one" is \'A table comment.\'','comment on column "test_table_one"."about" is \'A comment.\'','alter table "test_table_one" add constraint test_table_one_email_unique unique ("email")','create index test_table_one_logins_index on "test_table_one" ("logins")','comment on column "test_table_one"."about" is \'A comment.\'','alter table "test_table_one" add constraint test_table_one_email_unique unique ("email")','create index test_table_one_logins_index on "test_table_one" ("logins")'] | ||
sql: ['create table "test_table_one" ("id" serial primary key not null, "first_name" varchar(255), "last_name" varchar(255), "email" varchar(255), "logins" integer default \'1\', "about" text, "created_at" timestamp, "updated_at" timestamp)','comment on table "test_table_one" is \'A table comment.\'','comment on column "test_table_one"."about" is \'A comment.\'','create index test_table_one_first_name_index on "test_table_one" ("first_name")','alter table "test_table_one" add constraint test_table_one_email_unique unique ("email")','create index test_table_one_logins_index on "test_table_one" ("logins")'] | ||
}, | ||
sqlite3: { | ||
bindings: [], | ||
sql: ['create table "test_table_one" ("id" integer primary key autoincrement not null, "first_name" varchar(255), "last_name" varchar(255), "email" varchar(255), "logins" integer default \'1\', "about" text, "created_at" datetime, "updated_at" datetime)','create unique index test_table_one_email_unique on "test_table_one" ("email")','create index test_table_one_logins_index on "test_table_one" ("logins")','create unique index test_table_one_email_unique on "test_table_one" ("email")','create index test_table_one_logins_index on "test_table_one" ("logins")'] | ||
sql: ['create table "test_table_one" ("id" integer primary key autoincrement not null, "first_name" varchar(255), "last_name" varchar(255), "email" varchar(255), "logins" integer default \'1\', "about" text, "created_at" datetime, "updated_at" datetime)','create index test_table_one_first_name_index on "test_table_one" ("first_name")','create unique index test_table_one_email_unique on "test_table_one" ("email")','create index test_table_one_logins_index on "test_table_one" ("logins")'] | ||
} | ||
@@ -48,7 +48,7 @@ }, | ||
bindings: [], | ||
sql: ['create table `test_table_three` (`main` int(11), `paragraph` text) default character set utf8 engine = InnoDB','alter table `test_table_three` add primary key test_table_three_main_primary(`main`)','alter table `test_table_three` add primary key test_table_three_main_primary(`main`)'] | ||
sql: ['create table `test_table_three` (`main` int(11), `paragraph` text) default character set utf8 engine = InnoDB','alter table `test_table_three` add primary key test_table_three_main_primary(`main`)'] | ||
}, | ||
postgresql: { | ||
bindings: [], | ||
sql: ['create table "test_table_three" ("main" integer, "paragraph" text default \'Lorem ipsum Qui quis qui in.\')','alter table "test_table_three" add primary key ("main")','alter table "test_table_three" add primary key ("main")'] | ||
sql: ['create table "test_table_three" ("main" integer, "paragraph" text default \'Lorem ipsum Qui quis qui in.\')','alter table "test_table_three" add primary key ("main")'] | ||
}, | ||
@@ -77,13 +77,13 @@ sqlite3: { | ||
bindings: [], | ||
sql: ['create table `test_foreign_table_two` (`id` int(11) unsigned not null auto_increment primary key, `fkey_two` int(11) unsigned) default character set utf8','alter table `test_foreign_table_two` add constraint test_foreign_table_two_fkey_two_foreign foreign key (`fkey_two`) references `test_table_two` (`id`)','alter table `test_foreign_table_two` add constraint test_foreign_table_two_fkey_two_foreign foreign key (`fkey_two`) references `test_table_two` (`id`)'] | ||
sql: ['create table `test_foreign_table_two` (`id` int(11) unsigned not null auto_increment primary key, `fkey_two` int(11) unsigned) default character set utf8','alter table `test_foreign_table_two` add constraint test_foreign_table_two_fkey_two_foreign foreign key (`fkey_two`) references `test_table_two` (`id`)'] | ||
}, | ||
postgresql: { | ||
bindings: [], | ||
sql: ['create table "test_foreign_table_two" ("id" serial primary key not null, "fkey_two" integer)','alter table "test_foreign_table_two" add constraint test_foreign_table_two_fkey_two_foreign foreign key ("fkey_two") references "test_table_two" ("id")','alter table "test_foreign_table_two" add constraint test_foreign_table_two_fkey_two_foreign foreign key ("fkey_two") references "test_table_two" ("id")'] | ||
sql: ['create table "test_foreign_table_two" ("id" serial primary key not null, "fkey_two" integer)','alter table "test_foreign_table_two" add constraint test_foreign_table_two_fkey_two_foreign foreign key ("fkey_two") references "test_table_two" ("id")'] | ||
}, | ||
sqlite3: { | ||
bindings: [], | ||
sql: ['create table "test_foreign_table_two" ("id" integer primary key autoincrement not null, "fkey_two" integer, foreign key("fkey_two") references "test_table_two"("id"), foreign key("fkey_two") references "test_table_two"("id"))'] | ||
sql: ['create table "test_foreign_table_two" ("id" integer primary key autoincrement not null, "fkey_two" integer, foreign key("fkey_two") references "test_table_two"("id"))'] | ||
} | ||
} | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
219809
5752