src/migration.js
function columnToSQL(col) {
	var sql = "`" + col.name + "` ";

	sql += nrutil.typeToSQL(col.type);

	if (col['additional']) {
		sql += ' ' + col['additional'];
	}

	if (!col['allow_null']) {
		sql += " NOT NULL";
	}

	if (col['default_value'] !== undefined) {
		var def = col['default_value']

		sql += " DEFAULT " + nrutil.serialize(def);
	}

	if (col.type == 'primary_key') {
		sql += " PRIMARY KEY AUTO_INCREMENT";
	}

	return sql;
}
function columnToSQL(col) {
	var sql = "`" + col.name + "` ";

	sql += nrutil.typeToSQL(col.type);

	if (col['additional']) {
		sql += ' ' + col['additional'];
	}

	if (!col['allow_null']) {
		sql += " NOT NULL";
	}

	if (col['default_value'] !== undefined) {
		var def = col['default_value']

		sql += " DEFAULT " + nrutil.serialize(def);
	}

	if (col.type == 'primary_key') {
		sql += " PRIMARY KEY AUTO_INCREMENT";
	}

	return sql;
}
function columnToSQL ( col ) { var sql = "`" + col . name + "` " ; sql += nrutil . typeToSQL ( col . type ) ; if ( col [ 'additional' ] ) { sql += ' ' + col [ 'additional' ] ; } if ( ! col [ 'allow_null' ] ) { sql += " NOT NULL" ; } if ( col [ 'default_value' ] !== undefined ) { var def = col [ 'default_value' ] sql += " DEFAULT " + nrutil . serialize ( def ) ; } if ( col . type == 'primary_key' ) { sql += " PRIMARY KEY AUTO_INCREMENT" ; } return sql ; }
Generates the SQL fragment defining a given column.
Generates the SQL fragment defining a given column .