mirror of
https://github.com/knex/knex.git
synced 2025-08-30 19:36:34 +00:00
adding a simple logo, trying to git gh pages back up
This commit is contained in:
parent
9928af4682
commit
e5fd8df44a
@ -95,6 +95,36 @@ exports.schemaGrammar = {
|
||||
// Compile a drop table (if exists) command.
|
||||
compileDropTableIfExists: function(blueprint, command) {
|
||||
return 'drop table if exists ' + this.wrapTable(blueprint);
|
||||
},
|
||||
|
||||
// Compile a drop index command.
|
||||
compileDropIndex: function(blueprint, command) {
|
||||
return 'drop index ' + command.index;
|
||||
},
|
||||
|
||||
// Create the column definition for a tiny integer type.
|
||||
typeTinyInteger: function() {
|
||||
return 'tinyint';
|
||||
},
|
||||
|
||||
// Create the column definition for a time type.
|
||||
typeTime: function(column) {
|
||||
return 'time';
|
||||
},
|
||||
|
||||
// Create the column definition for a date type.
|
||||
typeDate: function(column) {
|
||||
return 'date';
|
||||
},
|
||||
|
||||
// Create the column definition for a binary type.
|
||||
typeBinary: function(column) {
|
||||
return 'blob';
|
||||
},
|
||||
|
||||
// Get the SQL for a nullable column modifier.
|
||||
modifyNullable: function(blueprint, column) {
|
||||
return column.isNullable ? ' null' : ' not null';
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -175,11 +175,6 @@ MysqlClient.schemaGrammar = _.extend({}, base.schemaGrammar, MysqlClient.grammar
|
||||
return 'int(' + column.length + ')';
|
||||
},
|
||||
|
||||
// Create the column definition for a tiny integer type.
|
||||
typeTinyInteger: function() {
|
||||
return 'tinyint';
|
||||
},
|
||||
|
||||
// Create the column definition for a float type.
|
||||
typeFloat: function(column) {
|
||||
return 'float(' + column.total + ',' + column.places + ')';
|
||||
@ -200,21 +195,11 @@ MysqlClient.schemaGrammar = _.extend({}, base.schemaGrammar, MysqlClient.grammar
|
||||
return "enum('" + column.allowed.join("', '") + "')";
|
||||
},
|
||||
|
||||
// Create the column definition for a date type.
|
||||
typeDate: function(column) {
|
||||
return 'date';
|
||||
},
|
||||
|
||||
// Create the column definition for a date-time type.
|
||||
typeDateTime: function(column) {
|
||||
return 'datetime';
|
||||
},
|
||||
|
||||
// Create the column definition for a time type.
|
||||
typeTime: function(column) {
|
||||
return 'time';
|
||||
},
|
||||
|
||||
// Create the column definition for a timestamp type.
|
||||
typeTimestamp: function(column) {
|
||||
return 'timestamp default 0';
|
||||
@ -225,21 +210,11 @@ MysqlClient.schemaGrammar = _.extend({}, base.schemaGrammar, MysqlClient.grammar
|
||||
return column.length !== false ? 'bit(' + column.length + ')' : 'bit';
|
||||
},
|
||||
|
||||
// Create the column definition for a binary type.
|
||||
typeBinary: function(column) {
|
||||
return 'blob';
|
||||
},
|
||||
|
||||
// Get the SQL for an unsigned column modifier.
|
||||
modifyUnsigned: function(blueprint, column) {
|
||||
if (column.isUnsigned) return ' unsigned';
|
||||
},
|
||||
|
||||
// Get the SQL for a nullable column modifier.
|
||||
modifyNullable: function(blueprint, column) {
|
||||
return column.isNullable ? ' null' : ' not null';
|
||||
},
|
||||
|
||||
// Get the SQL for a default column modifier.
|
||||
modifyDefault: function(blueprint, column) {
|
||||
// TODO - no default on blob/text
|
||||
|
@ -157,11 +157,6 @@ PostgresClient.schemaGrammar = _.extend({}, base.schemaGrammar, PostgresClient.g
|
||||
return "alter table " + table + " drop constraint " + command.index;
|
||||
},
|
||||
|
||||
// Compile a drop index command.
|
||||
compileDropIndex: function(blueprint, command) {
|
||||
return "drop index " + command.index;
|
||||
},
|
||||
|
||||
// Compile a drop foreign key command.
|
||||
compileDropForeign: function(blueprint, command) {
|
||||
var table = this.wrapTable(blueprint);
|
||||
@ -213,21 +208,11 @@ PostgresClient.schemaGrammar = _.extend({}, base.schemaGrammar, PostgresClient.g
|
||||
return "enum('" + column.allowed.join("', '") + "')";
|
||||
},
|
||||
|
||||
// Create the column definition for a date type.
|
||||
typeDate: function(column) {
|
||||
return 'date';
|
||||
},
|
||||
|
||||
// Create the column definition for a date-time type.
|
||||
typeDateTime: function(column) {
|
||||
return 'timestamp';
|
||||
},
|
||||
|
||||
// Create the column definition for a time type.
|
||||
typeTime: function(column) {
|
||||
return 'time';
|
||||
},
|
||||
|
||||
// Create the column definition for a timestamp type.
|
||||
typeTimestamp: function(column) {
|
||||
return 'timestamp';
|
||||
@ -243,11 +228,6 @@ PostgresClient.schemaGrammar = _.extend({}, base.schemaGrammar, PostgresClient.g
|
||||
return 'bytea';
|
||||
},
|
||||
|
||||
// Get the SQL for a nullable column modifier.
|
||||
modifyNullable: function(blueprint, column) {
|
||||
return column.isNullable ? ' null' : ' not null';
|
||||
},
|
||||
|
||||
// Get the SQL for a default column modifier.
|
||||
modifyDefault: function(blueprint, column) {
|
||||
if (column.defaultValue) {
|
||||
|
@ -240,11 +240,6 @@ Sqlite3Client.schemaGrammar = _.extend({}, base.schemaGrammar, Sqlite3Client.gra
|
||||
return 'drop index ' + command.index;
|
||||
},
|
||||
|
||||
// Compile a drop index command.
|
||||
compileDropIndex: function(blueprint, command) {
|
||||
return 'drop index ' + command.index;
|
||||
},
|
||||
|
||||
// Compile a rename table command.
|
||||
compileRenameTable: function(blueprint, command) {
|
||||
return 'alter table ' + this.wrapTable(blueprint) + ' rename to ' + this.wrapTable(command.to);
|
||||
@ -280,43 +275,23 @@ Sqlite3Client.schemaGrammar = _.extend({}, base.schemaGrammar, Sqlite3Client.gra
|
||||
return 'tinyint';
|
||||
},
|
||||
|
||||
// Create the column definition for a tinyint type.
|
||||
typeTinyInteger: function() {
|
||||
return 'tinyint';
|
||||
},
|
||||
|
||||
// Create the column definition for a enum type.
|
||||
typeEnum: function(column) {
|
||||
return 'varchar';
|
||||
},
|
||||
|
||||
// Create the column definition for a date type.
|
||||
typeDate: function(column) {
|
||||
return 'date';
|
||||
},
|
||||
|
||||
// Create the column definition for a date-time type.
|
||||
typeDateTime: function(column) {
|
||||
return 'datetime';
|
||||
},
|
||||
|
||||
// Create the column definition for a time type.
|
||||
typeTime: function(column) {
|
||||
return 'time';
|
||||
},
|
||||
|
||||
|
||||
// Create the column definition for a timestamp type.
|
||||
typeTimestamp: function(column) {
|
||||
return 'datetime';
|
||||
},
|
||||
|
||||
// Create the column definition for a binary type.
|
||||
typeBinary: function(column) {
|
||||
return 'blob';
|
||||
},
|
||||
|
||||
|
||||
// Get the SQL for a nullable column modifier.
|
||||
modifyNullable: function(blueprint, column) {
|
||||
modifyNullable: function(blueprint) {
|
||||
return ' null';
|
||||
},
|
||||
|
||||
|
BIN
docs/images/knex.png
Normal file
BIN
docs/images/knex.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 115 KiB |
@ -111,8 +111,10 @@ used to generate the sql in one form or another.</p>
|
||||
|
||||
_debug: <span class="literal">false</span>,
|
||||
|
||||
debug: <span class="keyword">function</span>(val) {
|
||||
<span class="keyword">this</span>._debug = val;
|
||||
_promise: <span class="literal">null</span>,
|
||||
|
||||
debug: <span class="keyword">function</span>() {
|
||||
<span class="keyword">this</span>._debug = <span class="literal">true</span>;
|
||||
<span class="keyword">return</span> <span class="keyword">this</span>;
|
||||
},</pre></div></div>
|
||||
|
||||
@ -125,13 +127,15 @@ used to generate the sql in one form or another.</p>
|
||||
<div class="pilwrap ">
|
||||
<a class="pilcrow" href="#section-6">¶</a>
|
||||
</div>
|
||||
<p>For those who dislike promise interfaces.</p>
|
||||
<p>For those who dislike promise interfaces.
|
||||
Multiple calls to <code>exec</code> will resolve with the same value
|
||||
if called more than once.</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> exec: <span class="keyword">function</span>(callback) {
|
||||
<span class="keyword">var</span> run = <span class="keyword">this</span>.runQuery();
|
||||
<span class="keyword">return</span> run.then(<span class="keyword">function</span>(resp) {
|
||||
<span class="keyword">this</span>._promise || (<span class="keyword">this</span>._promise = <span class="keyword">this</span>.runQuery());
|
||||
<span class="keyword">return</span> <span class="keyword">this</span>._promise.then(<span class="keyword">function</span>(resp) {
|
||||
callback(<span class="literal">null</span>, resp);
|
||||
}, <span class="keyword">function</span>(err) {
|
||||
callback(err, <span class="literal">null</span>);
|
||||
@ -152,8 +156,8 @@ used to generate the sql in one form or another.</p>
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> then: <span class="keyword">function</span>(onFulfilled, onRejected) {
|
||||
<span class="keyword">var</span> run = <span class="keyword">this</span>.runQuery();
|
||||
<span class="keyword">return</span> run.then(onFulfilled, onRejected);
|
||||
<span class="keyword">this</span>._promise || (<span class="keyword">this</span>._promise = <span class="keyword">this</span>.runQuery());
|
||||
<span class="keyword">return</span> <span class="keyword">this</span>._promise.then(onFulfilled, onRejected);
|
||||
},</pre></div></div>
|
||||
|
||||
</li>
|
||||
@ -345,9 +349,7 @@ and have it come out fine.</p>
|
||||
<span class="string">'orders'</span>, <span class="string">'limit'</span>, <span class="string">'offset'</span>, <span class="string">'unions'</span>
|
||||
];
|
||||
|
||||
Knex.Grammar = {
|
||||
|
||||
dateFormat: <span class="string">'Y-m-d H:i:s'</span>,</pre></div></div>
|
||||
Knex.Grammar = {</pre></div></div>
|
||||
|
||||
</li>
|
||||
|
||||
@ -1214,13 +1216,12 @@ where key = value. </p>
|
||||
</div>
|
||||
|
||||
<div class="content"><div class='highlight'><pre> where: <span class="keyword">function</span>(column, operator, value, bool) {
|
||||
<span class="keyword">var</span> key;
|
||||
bool || (bool = <span class="string">'and'</span>);
|
||||
<span class="keyword">if</span> (_.isFunction(column)) {
|
||||
<span class="keyword">return</span> <span class="keyword">this</span>._whereNested(column, bool);
|
||||
}
|
||||
<span class="keyword">if</span> (_.isObject(column)) {
|
||||
<span class="keyword">for</span> (key <span class="keyword">in</span> column) {
|
||||
<span class="keyword">for</span> (<span class="keyword">var</span> key <span class="keyword">in</span> column) {
|
||||
value = column[key];
|
||||
<span class="keyword">this</span>[bool + <span class="string">'Where'</span>](key, <span class="string">'='</span>, value);
|
||||
}
|
||||
|
@ -67,8 +67,7 @@
|
||||
margin: 40px 0 50px 260px;
|
||||
}
|
||||
img#logo {
|
||||
width: 396px;
|
||||
height: 69px;
|
||||
width: 450px;
|
||||
}
|
||||
div.warning {
|
||||
margin-top: 15px;
|
||||
@ -275,7 +274,7 @@
|
||||
<div class="container">
|
||||
|
||||
<p>
|
||||
<h1>Knex.js</h1>
|
||||
<img id="logo" src="docs/images/knex.png" alt="Knex.js">
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
Loading…
x
Reference in New Issue
Block a user