Open sinux-l5d opened 2 years ago
Hi,
I'm trying DenoDB with a simple example : store users in a sqlite database.
But two issues occurs when inserting a user:
What am I missing ?
Minimal example :
class UserModel extends Model { static table = "users"; static timestamps = true; id!: string; login!: string; password!: string; static fields = { id: { type: DataTypes.UUID, primaryKey: true }, login: { type: DataTypes.STRING, length: 20, unique: true }, password: DataTypes.string(128), }; static defaults = { id: () => globalThis.crypto.randomUUID(), }; } const connexion = new SQLite3Connector({ filepath: "test.sqlite3", }); const db = new Database(connexion); db.link([UserModel]); db.sync(); const userDB = await UserModel.create({ login: "test", password: "test", }); console.log(userDB); /* UserModel { id: undefined, login: undefined, password: undefined, affectedRows: 1, lastInsertId: 1 } */
Hi, so is it a bug, or a misunderstanding?
Hi,
I'm trying DenoDB with a simple example : store users in a sqlite database.
But two issues occurs when inserting a user:
What am I missing ?
Minimal example :