We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
var persistence = require('persistencejs'); var persistenceStore = persistence.StoreConfig.init(persistence, { adaptor: 'mysql' }); persistenceStore.config(persistence, 'localhost', 3306, 'nodedb', 'root', 'root');
var session = persistenceStore.getSession();
var User = persistence.define('user', { email: "TEXT", password : "TEXT", first_name : "TEXT", last_name : "TEXT" });
var user = new User({email:'[email protected]',password : 'world',first_name : "world",last_name:'world'});
session.add(user); session.transaction(function(tx) { session.flush(tx,function(result){
console.log(result.insertId); });
});
session.close();
it alway create random primary key and also some time duplicate key problem occurs. below the following sql create query :
CREATE TABLE user ( id int(11) NOT NULL AUTO_INCREMENT, email varchar(45) NOT NULL, password varchar(45) NOT NULL, first_name varchar(45) DEFAULT NULL, last_name varchar(45) DEFAULT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
user
id
email
password
first_name
last_name
The text was updated successfully, but these errors were encountered:
No branches or pull requests
var persistence = require('persistencejs');
var persistenceStore = persistence.StoreConfig.init(persistence, { adaptor: 'mysql' });
persistenceStore.config(persistence, 'localhost', 3306, 'nodedb', 'root', 'root');
var session = persistenceStore.getSession();
var User = persistence.define('user', {
email: "TEXT",
password : "TEXT",
first_name : "TEXT",
last_name : "TEXT"
});
var user = new User({email:'[email protected]',password : 'world',first_name : "world",last_name:'world'});
session.add(user);
session.transaction(function(tx) {
session.flush(tx,function(result){
});
session.close();
it alway create random primary key and also some time duplicate key problem occurs.
below the following sql create query :
CREATE TABLE
user
(id
int(11) NOT NULL AUTO_INCREMENT,email
varchar(45) NOT NULL,password
varchar(45) NOT NULL,first_name
varchar(45) DEFAULT NULL,last_name
varchar(45) DEFAULT NULL,PRIMARY KEY (
id
)) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
The text was updated successfully, but these errors were encountered: