You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATE TABLE Product_Entity (
uid uuid DEFAULT uuid_generate_v4(),
title text NOT NULL,
description text NOT NULL,
price numeric NOT NULL,
category text NOT NULL,
image text,
rating text,
PRIMARY KEY (uid)
);
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
INSERT INTO Product_Entity (title, description, price, category) VALUES ('This is Title 1', 'This is description 1', 2.5, 'sports');
SELECT * from Product_Entity;
Above queries works perfectly. I am using postico2.
//////// NOW ////////////////////
Model class using Stormberry.
@Model(tableName: 'Product_Entity')
abstract class ProductEntity {
@PrimaryKey()
String? get uid;
String get title;
String get description;
double get price;
String get category;
}
I have to add to features for this: uuids as keys and default values. I think currently there isn't really a workaround except providing a uuid manually when inserting.
Hi,
I am using
Dart_Frog
,Stormberry
,Postgres
.Above queries works perfectly. I am using
postico2
.//////// NOW ////////////////////
Model class using Stormberry.
After
.schema.g.dart
generated:///////// insert query looks like
Problem:
When trying to insert data using Dart_Frog as
It's throw this error:
INSERT INTO "Product_Entity" ( "uid", "title", "description", "price", "category" )
VALUES ( null, 'Product title 1', 'This is Product Description 1', 2.5, 'computers' )
ON CONFLICT ( "uid" ) DO UPDATE SET "title" = EXCLUDED."title", "description" = EXCLUDED."description", "price" = EXCLUDED."price", "category" = EXCLUDED."category"
[ERROR] 2022-12-22 23:22:57.797018 0:00:00.013230 POST /products
the issue is
InsertQuery
trying to insertnull
value inuid
(ie: primaryKey)...insertOne
does NOT return anything....I guess, It should return uuid.IDK, how to
discard
primary key field for InsertQuery, while using uuid_generate_v4 ?The text was updated successfully, but these errors were encountered: