Serialized Model option rather than classes?
reggi opened this issue · comments
I'm curious if there's a way to create a more generic model that allows for you to serialize the table schema. Something like this:
const Flights = model({
table: 'flights';
timestamps: true;
fields: {
id: { primaryKey: true, autoIncrement: true },
departure: DataTypes.STRING,
destination: DataTypes.STRING,
flightDuration: DataTypes.FLOAT,
};
defaults: {
flightDuration: 2.5,
};
})
Then perhaps be able to call some more generic method for inserting.
insert('flights', {...data})