Skip to content
New issue

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

types.Hstore does not works #1334

Open
alexisvisco opened this issue Dec 18, 2023 · 1 comment
Open

types.Hstore does not works #1334

alexisvisco opened this issue Dec 18, 2023 · 1 comment

Comments

@alexisvisco
Copy link

alexisvisco commented Dec 18, 2023

If you're having a generation problem please answer these questions before submitting your issue. Thanks!

What version of SQLBoiler are you using (sqlboiler --version)?

SQLBoiler v4.15.0

What is your database and version (eg. Postgresql 10)

postgres 16.1

If this happened at generation time what was the full SQLBoiler command you used to generate your models? (if not applicable leave blank)

If this happened at runtime what code produced the issue? (if not applicable leave blank)

With a hstore in the schema I got those types Features types.HStore from "github.com/volatiletech/sqlboiler/v4/types"

When I insert an object with a hstore, I got this :

INSERT INTO "products" ("title","description","features","specifications","created_at","updated_at") VALUES ($1,$2,$3,$4,$5,$6) RETURNING "id"
[some_product some_description map[feature1:{value1 true} feature2:{value2 true}] map[spec1:{value1 true} spec2:{value2 true}] {2023-12-16 19:24:44.77235 +0000 UTC true} {2023-12-16 19:24:44.77235 +0000 UTC true}]
models: unable to insert into products: ERROR: syntax error in hstore: unexpected end of string

What is the output of the command above with the -d flag added to it? (Provided you are comfortable sharing this, it contains a blueprint of your schema)

-d output
using driver: /Users/alexisviscogliosi/go/bin/sqlboiler-psql
{"config":{"driver_name":"psql","driver_config":{"add-enum-types":true,"blacklist":null,"dbname":"postgres","enum-null-prefix":"Null","foreign-keys":null,"host":"localhost","pass":"postgres","port":5444,"sslmode":"disable","user":"postgres","whitelist":null},"pkg_name":"models","out_folder":"models","debug":true,"add_enum_types":true,"enum_null_prefix":"Null","no_tests":true,"wipe":true,"struct_tag_casing":"snake","relation_tag":"-","imports":{"all":{"Standard":["\"database/sql\"","\"fmt\"","\"reflect\"","\"strconv\"","\"strings\"","\"sync\"","\"time\"","\"context\""],"ThirdParty":["\"github.com/friendsofgo/errors\"","\"github.com/volatiletech/sqlboiler/v4/boil\"","\"github.com/volatiletech/sqlboiler/v4/queries\"","\"github.com/volatiletech/sqlboiler/v4/queries/qm\"","\"github.com/volatiletech/sqlboiler/v4/queries/qmhelper\"","\"github.com/volatiletech/strmangle\""]},"test":{"Standard":["\"bytes\"","\"reflect\"","\"testing\"","\"context\""],"ThirdParty":["\"github.com/volatiletech/randomize\"","\"github.com/volatiletech/sqlboiler/v4/boil\"","\"github.com/volatiletech/sqlboiler/v4/queries\"","\"github.com/volatiletech/strmangle\""]},"singleton":{"boil_queries":{"Standard":["\"regexp\""],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/drivers\"","\"github.com/volatiletech/sqlboiler/v4/queries\"","\"github.com/volatiletech/sqlboiler/v4/queries/qm\""]},"boil_types":{"Standard":["\"strconv\""],"ThirdParty":["\"github.com/friendsofgo/errors\"","\"github.com/volatiletech/sqlboiler/v4/boil\"","\"github.com/volatiletech/strmangle\""]},"psql_upsert":{"Standard":["\"fmt\"","\"strings\""],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/drivers\"","\"github.com/volatiletech/strmangle\""]}},"test_singleton":{"boil_main_test":{"Standard":["\"database/sql\"","\"flag\"","\"fmt\"","\"math/rand\"","\"os\"","\"path/filepath\"","\"strings\"","\"testing\"","\"time\""],"ThirdParty":["\"github.com/spf13/viper\"","\"github.com/volatiletech/sqlboiler/v4/boil\""]},"boil_queries_test":{"Standard":["\"bytes\"","\"fmt\"","\"io\"","\"math/rand\"","\"regexp\""],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/boil\""]},"boil_suites_test":{"Standard":["\"testing\""],"ThirdParty":null},"psql_main_test":{"Standard":["\"bytes\"","\"database/sql\"","\"fmt\"","\"io\"","\"os\"","\"os/exec\"","\"regexp\"","\"strings\""],"ThirdParty":["\"github.com/friendsofgo/errors\"","\"github.com/kat-co/vala\"","_ \"github.com/lib/pq\"","\"github.com/spf13/viper\"","\"github.com/volatiletech/randomize\"","\"github.com/volatiletech/sqlboiler/v4/drivers/sqlboiler-psql/driver\""]},"psql_suites_test":{"Standard":["\"testing\""],"ThirdParty":[]}},"based_on_type":{"null.Bool":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/null/v8\""]},"null.Bytes":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/null/v8\""]},"null.Float32":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/null/v8\""]},"null.Float64":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/null/v8\""]},"null.Int":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/null/v8\""]},"null.Int16":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/null/v8\""]},"null.Int32":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/null/v8\""]},"null.Int64":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/null/v8\""]},"null.Int8":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/null/v8\""]},"null.JSON":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/null/v8\""]},"null.String":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/null/v8\""]},"null.Time":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/null/v8\""]},"null.Uint":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/null/v8\""]},"null.Uint16":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/null/v8\""]},"null.Uint32":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/null/v8\""]},"null.Uint64":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/null/v8\""]},"null.Uint8":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/null/v8\""]},"pgeo.Box":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types/pgeo\""]},"pgeo.Circle":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types/pgeo\""]},"pgeo.Line":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types/pgeo\""]},"pgeo.Lseg":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types/pgeo\""]},"pgeo.NullBox":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types/pgeo\""]},"pgeo.NullCircle":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types/pgeo\""]},"pgeo.NullLine":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types/pgeo\""]},"pgeo.NullLseg":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types/pgeo\""]},"pgeo.NullPath":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types/pgeo\""]},"pgeo.NullPoint":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types/pgeo\""]},"pgeo.NullPolygon":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types/pgeo\""]},"pgeo.Path":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types/pgeo\""]},"pgeo.Point":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types/pgeo\""]},"pgeo.Polygon":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types/pgeo\""]},"time.Time":{"Standard":["\"time\""],"ThirdParty":[]},"types.BoolArray":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types\""]},"types.Byte":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types\""]},"types.BytesArray":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types\""]},"types.Decimal":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types\""]},"types.DecimalArray":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types\""]},"types.Float64Array":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types\""]},"types.HStore":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types\""]},"types.Int64Array":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types\""]},"types.JSON":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types\""]},"types.NullDecimal":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types\""]},"types.StringArray":{"Standard":[],"ThirdParty":["\"github.com/volatiletech/sqlboiler/v4/types\""]}}},"aliases":{"tables":{"atlas_schema_revisions":{"up_plural":"AtlasSchemaRevisions","up_singular":"AtlasSchemaRevision","down_plural":"atlasSchemaRevisions","down_singular":"atlasSchemaRevision","columns":{"applied":"Applied","description":"Description","error":"Error","error_stmt":"ErrorSTMT","executed_at":"ExecutedAt","execution_time":"ExecutionTime","hash":"Hash","operator_version":"OperatorVersion","partial_hashes":"PartialHashes","total":"Total","type":"Type","version":"Version"}},"order_items":{"up_plural":"OrderItems","up_singular":"OrderItem","down_plural":"orderItems","down_singular":"orderItem","columns":{"created_at":"CreatedAt","description":"Description","id":"ID","image":"Image","order_id":"OrderID","price":"Price","quantity":"Quantity","stripe_product_id":"StripeProductID","title":"Title","updated_at":"UpdatedAt"},"relationships":{"fk_order_items_order_id":{"local":"OrderItems","foreign":"Order"}}},"orders":{"up_plural":"Orders","up_singular":"Order","down_plural":"orders","down_singular":"order","columns":{"created_at":"CreatedAt","customer_email":"CustomerEmail","customer_first_name":"CustomerFirstName","customer_last_name":"CustomerLastName","customer_phone":"CustomerPhone","id":"ID","shipping_city":"ShippingCity","shipping_country":"ShippingCountry","shipping_line1":"ShippingLine1","shipping_line2":"ShippingLine2","shipping_postal_code":"ShippingPostalCode","shipping_state":"ShippingState","status":"Status","stripe_customer_id":"StripeCustomerID","stripe_payment_id":"StripePaymentID","stripe_session_id":"StripeSessionID","updated_at":"UpdatedAt"}},"product_variants":{"up_plural":"ProductVariants","up_singular":"ProductVariant","down_plural":"productVariants","down_singular":"productVariant","columns":{"attributes":"Attributes","created_at":"CreatedAt","id":"ID","price":"Price","product_id":"ProductID","quantity":"Quantity","sku":"Sku","stripe_price_id":"StripePriceID","stripe_product_id":"StripeProductID","updated_at":"UpdatedAt"},"relationships":{"fk_product_variants_product_id":{"local":"ProductVariants","foreign":"Product"}}},"products":{"up_plural":"Products","up_singular":"Product","down_plural":"products","down_singular":"product","columns":{"created_at":"CreatedAt","description":"Description","features":"Features","id":"ID","specifications":"Specifications","title":"Title","updated_at":"UpdatedAt"}}}},"auto_columns":{},"inflections":{"Plural":{},"PluralExact":{},"Singular":{},"SingularExact":{},"Irregular":{}},"version":"4.15.0"},"driver_config":{"add-enum-types":true,"blacklist":null,"dbname":"postgres","enum-null-prefix":"Null","foreign-keys":null,"host":"localhost","pass":"postgres","port":5444,"sslmode":"disable","user":"postgres","whitelist":null},"schema":"public","dialect":{"lq":34,"rq":34,"use_index_placeholders":true,"use_last_insert_id":false,"use_schema":false,"use_default_keyword":true,"use_top_clause":false,"use_output_clause":false,"use_case_when_exists_clause":false,"use_auto_columns":false},"tables":[{"name":"atlas_schema_revisions","schema_name":"","columns":[{"name":"version","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":true,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"varchar"},{"name":"description","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"varchar"},{"name":"type","type":"int64","db_type":"bigint","default":"2","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"int8","domain_name":null,"full_db_type":"int8"},{"name":"applied","type":"int64","db_type":"bigint","default":"0","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"int8","domain_name":null,"full_db_type":"int8"},{"name":"total","type":"int64","db_type":"bigint","default":"0","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"int8","domain_name":null,"full_db_type":"int8"},{"name":"executed_at","type":"time.Time","db_type":"timestamp with time zone","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"timestamptz","domain_name":null,"full_db_type":"timestamptz"},{"name":"execution_time","type":"int64","db_type":"bigint","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"int8","domain_name":null,"full_db_type":"int8"},{"name":"error","type":"null.String","db_type":"text","default":"NULL","comment":"","nullable":true,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"text","domain_name":null,"full_db_type":"text"},{"name":"error_stmt","type":"null.String","db_type":"text","default":"NULL","comment":"","nullable":true,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"text","domain_name":null,"full_db_type":"text"},{"name":"hash","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"varchar"},{"name":"partial_hashes","type":"null.JSON","db_type":"jsonb","default":"NULL","comment":"","nullable":true,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"jsonb","domain_name":null,"full_db_type":"jsonb"},{"name":"operator_version","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"varchar"}],"p_key":{"name":"atlas_schema_revisions_pkey","columns":["version"]},"f_keys":null,"is_join_table":false,"to_one_relationships":null,"to_many_relationships":null,"is_view":false,"view_capabilities":{"can_insert":false,"can_upsert":false}},{"name":"order_items","schema_name":"","columns":[{"name":"id","type":"int","db_type":"integer","default":"nextval('order_items_id_seq'::regclass)","comment":"","nullable":false,"unique":true,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"int4","domain_name":null,"full_db_type":"int4"},{"name":"title","type":"string","db_type":"character varying","default":"'-'::character varying","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"description","type":"string","db_type":"character varying","default":"'-'::character varying","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"order_id","type":"int","db_type":"integer","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"int4","domain_name":null,"full_db_type":"int4"},{"name":"stripe_product_id","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"quantity","type":"int","db_type":"integer","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"int4","domain_name":null,"full_db_type":"int4"},{"name":"price","type":"int","db_type":"integer","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"int4","domain_name":null,"full_db_type":"int4"},{"name":"image","type":"null.String","db_type":"character varying","default":"NULL","comment":"","nullable":true,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"created_at","type":"null.Time","db_type":"timestamp without time zone","default":"(now() AT TIME ZONE 'utc'::text)","comment":"","nullable":true,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"timestamp","domain_name":null,"full_db_type":"timestamp"},{"name":"updated_at","type":"null.Time","db_type":"timestamp without time zone","default":"(now() AT TIME ZONE 'utc'::text)","comment":"","nullable":true,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"timestamp","domain_name":null,"full_db_type":"timestamp"}],"p_key":{"name":"order_items_pkey","columns":["id"]},"f_keys":[{"table":"order_items","name":"fk_order_items_order_id","column":"order_id","nullable":false,"unique":false,"foreign_table":"orders","foreign_column":"id","foreign_column_nullable":false,"foreign_column_unique":true}],"is_join_table":false,"to_one_relationships":null,"to_many_relationships":null,"is_view":false,"view_capabilities":{"can_insert":false,"can_upsert":false}},{"name":"orders","schema_name":"","columns":[{"name":"id","type":"int","db_type":"integer","default":"nextval('orders_id_seq'::regclass)","comment":"","nullable":false,"unique":true,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"int4","domain_name":null,"full_db_type":"int4"},{"name":"stripe_payment_id","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"stripe_session_id","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"stripe_customer_id","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"status","type":"OrderStatus","db_type":"enum.order_status('awaiting_shipment','partially_shipped','completed','shipped','cancelled','declined','refunded','disputed','manual_verification_required','partially_refunded')","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"order_status","domain_name":null,"full_db_type":"order_status"},{"name":"customer_email","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"customer_first_name","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"customer_last_name","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"customer_phone","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"shipping_city","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"shipping_line1","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"shipping_line2","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"shipping_state","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"shipping_country","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"shipping_postal_code","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"created_at","type":"null.Time","db_type":"timestamp without time zone","default":"(now() AT TIME ZONE 'utc'::text)","comment":"","nullable":true,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"timestamp","domain_name":null,"full_db_type":"timestamp"},{"name":"updated_at","type":"null.Time","db_type":"timestamp without time zone","default":"(now() AT TIME ZONE 'utc'::text)","comment":"","nullable":true,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"timestamp","domain_name":null,"full_db_type":"timestamp"}],"p_key":{"name":"orders_pkey","columns":["id"]},"f_keys":null,"is_join_table":false,"to_one_relationships":null,"to_many_relationships":[{"name":"fk_order_items_order_id","table":"orders","column":"id","nullable":false,"unique":true,"foreign_table":"order_items","foreign_column":"order_id","foreign_column_nullable":false,"foreign_column_unique":false,"to_join_table":false,"join_table":"","join_local_fkey_name":"","join_local_column":"","join_local_column_nullable":false,"join_local_column_unique":false,"join_foreign_fkey_name":"","join_foreign_column":"","join_foreign_column_nullable":false,"join_foreign_column_unique":false}],"is_view":false,"view_capabilities":{"can_insert":false,"can_upsert":false}},{"name":"product_variants","schema_name":"","columns":[{"name":"id","type":"int","db_type":"integer","default":"nextval('product_variants_id_seq'::regclass)","comment":"","nullable":false,"unique":true,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"int4","domain_name":null,"full_db_type":"int4"},{"name":"product_id","type":"int","db_type":"integer","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"int4","domain_name":null,"full_db_type":"int4"},{"name":"sku","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(8)"},{"name":"quantity","type":"null.Int","db_type":"integer","default":"NULL","comment":"","nullable":true,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"int4","domain_name":null,"full_db_type":"int4"},{"name":"price","type":"int","db_type":"integer","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"int4","domain_name":null,"full_db_type":"int4"},{"name":"attributes","type":"types.HStore","db_type":"hstore","default":"NULL","comment":"","nullable":true,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"hstore","domain_name":null,"full_db_type":"hstore"},{"name":"created_at","type":"null.Time","db_type":"timestamp without time zone","default":"(now() AT TIME ZONE 'utc'::text)","comment":"","nullable":true,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"timestamp","domain_name":null,"full_db_type":"timestamp"},{"name":"updated_at","type":"null.Time","db_type":"timestamp without time zone","default":"(now() AT TIME ZONE 'utc'::text)","comment":"","nullable":true,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"timestamp","domain_name":null,"full_db_type":"timestamp"},{"name":"stripe_product_id","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"stripe_price_id","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"}],"p_key":{"name":"product_variants_pkey","columns":["id"]},"f_keys":[{"table":"product_variants","name":"fk_product_variants_product_id","column":"product_id","nullable":false,"unique":false,"foreign_table":"products","foreign_column":"id","foreign_column_nullable":false,"foreign_column_unique":true}],"is_join_table":false,"to_one_relationships":null,"to_many_relationships":null,"is_view":false,"view_capabilities":{"can_insert":false,"can_upsert":false}},{"name":"products","schema_name":"","columns":[{"name":"id","type":"int","db_type":"integer","default":"nextval('products_id_seq'::regclass)","comment":"","nullable":false,"unique":true,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"int4","domain_name":null,"full_db_type":"int4"},{"name":"title","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"description","type":"string","db_type":"character varying","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"varchar","domain_name":null,"full_db_type":"character varying(255)"},{"name":"features","type":"types.HStore","db_type":"hstore","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"hstore","domain_name":null,"full_db_type":"hstore"},{"name":"specifications","type":"types.HStore","db_type":"hstore","default":"","comment":"","nullable":false,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"hstore","domain_name":null,"full_db_type":"hstore"},{"name":"created_at","type":"null.Time","db_type":"timestamp without time zone","default":"(now() AT TIME ZONE 'utc'::text)","comment":"","nullable":true,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"timestamp","domain_name":null,"full_db_type":"timestamp"},{"name":"updated_at","type":"null.Time","db_type":"timestamp without time zone","default":"(now() AT TIME ZONE 'utc'::text)","comment":"","nullable":true,"unique":false,"validated":false,"auto_generated":false,"arr_type":null,"udt_name":"timestamp","domain_name":null,"full_db_type":"timestamp"}],"p_key":{"name":"products_pkey","columns":["id"]},"f_keys":null,"is_join_table":false,"to_one_relationships":null,"to_many_relationships":[{"name":"fk_product_variants_product_id","table":"products","column":"id","nullable":false,"unique":true,"foreign_table":"product_variants","foreign_column":"product_id","foreign_column_nullable":false,"foreign_column_unique":false,"to_join_table":false,"join_table":"","join_local_fkey_name":"","join_local_column":"","join_local_column_nullable":false,"join_local_column_unique":false,"join_foreign_fkey_name":"","join_foreign_column":"","join_foreign_column_nullable":false,"join_foreign_column_unique":false}],"is_view":false,"view_capabilities":{"can_insert":false,"can_upsert":false}}],"templates":[{"name":"main/00_struct.go.tpl","loader":"asset:main/00_struct.go.tpl"},{"name":"main/01_types.go.tpl","loader":"asset:main/01_types.go.tpl"},{"name":"main/02_hooks.go.tpl","loader":"asset:main/02_hooks.go.tpl"},{"name":"main/03_finishers.go.tpl","loader":"asset:main/03_finishers.go.tpl"},{"name":"main/04_relationship_to_one.go.tpl","loader":"asset:main/04_relationship_to_one.go.tpl"},{"name":"main/05_relationship_one_to_one.go.tpl","loader":"asset:main/05_relationship_one_to_one.go.tpl"},{"name":"main/06_relationship_to_many.go.tpl","loader":"asset:main/06_relationship_to_many.go.tpl"},{"name":"main/07_relationship_to_one_eager.go.tpl","loader":"asset:main/07_relationship_to_one_eager.go.tpl"},{"name":"main/08_relationship_one_to_one_eager.go.tpl","loader":"asset:main/08_relationship_one_to_one_eager.go.tpl"},{"name":"main/09_relationship_to_many_eager.go.tpl","loader":"asset:main/09_relationship_to_many_eager.go.tpl"},{"name":"main/10_relationship_to_one_setops.go.tpl","loader":"asset:main/10_relationship_to_one_setops.go.tpl"},{"name":"main/11_relationship_one_to_one_setops.go.tpl","loader":"asset:main/11_relationship_one_to_one_setops.go.tpl"},{"name":"main/12_relationship_to_many_setops.go.tpl","loader":"asset:main/12_relationship_to_many_setops.go.tpl"},{"name":"main/13_all.go.tpl","loader":"asset:main/13_all.go.tpl"},{"name":"main/14_find.go.tpl","loader":"asset:main/14_find.go.tpl"},{"name":"main/15_insert.go.tpl","loader":"asset:main/15_insert.go.tpl"},{"name":"main/16_update.go.tpl","loader":"asset:main/16_update.go.tpl"},{"name":"main/17_upsert.go.tpl","loader":"base64:(sha256 of content): 52fd3a5d952e511f6c2866d79fb418d1d348df36d4924c40bee6ce14cbc322bf"},{"name":"main/18_delete.go.tpl","loader":"asset:main/18_delete.go.tpl"},{"name":"main/19_reload.go.tpl","loader":"asset:main/19_reload.go.tpl"},{"name":"main/20_exists.go.tpl","loader":"asset:main/20_exists.go.tpl"},{"name":"main/21_auto_timestamps.go.tpl","loader":"asset:main/21_auto_timestamps.go.tpl"},{"name":"main/22_ilike.go.tpl","loader":"base64:(sha256 of content): b590db21a38fc42dd892905f7b4fa0e41ab0339717a8d577c0a807374ff6abde"},{"name":"main/singleton/boil_queries.go.tpl","loader":"asset:main/singleton/boil_queries.go.tpl"},{"name":"main/singleton/boil_table_names.go.tpl","loader":"asset:main/singleton/boil_table_names.go.tpl"},{"name":"main/singleton/boil_types.go.tpl","loader":"asset:main/singleton/boil_types.go.tpl"},{"name":"main/singleton/boil_view_names.go.tpl","loader":"asset:main/singleton/boil_view_names.go.tpl"},{"name":"main/singleton/psql_upsert.go.tpl","loader":"base64:(sha256 of content): 6ed2252acf7e3a4f38b4a06364490bbf80737df964ee26dd82958d3739c1358d"},{"name":"test/00_types.go.tpl","loader":"asset:test/00_types.go.tpl"},{"name":"test/all.go.tpl","loader":"asset:test/all.go.tpl"},{"name":"test/delete.go.tpl","loader":"asset:test/delete.go.tpl"},{"name":"test/exists.go.tpl","loader":"asset:test/exists.go.tpl"},{"name":"test/find.go.tpl","loader":"asset:test/find.go.tpl"},{"name":"test/finishers.go.tpl","loader":"asset:test/finishers.go.tpl"},{"name":"test/hooks.go.tpl","loader":"asset:test/hooks.go.tpl"},{"name":"test/insert.go.tpl","loader":"asset:test/insert.go.tpl"},{"name":"test/relationship_one_to_one.go.tpl","loader":"asset:test/relationship_one_to_one.go.tpl"},{"name":"test/relationship_one_to_one_setops.go.tpl","loader":"asset:test/relationship_one_to_one_setops.go.tpl"},{"name":"test/relationship_to_many.go.tpl","loader":"asset:test/relationship_to_many.go.tpl"},{"name":"test/relationship_to_many_setops.go.tpl","loader":"asset:test/relationship_to_many_setops.go.tpl"},{"name":"test/relationship_to_one.go.tpl","loader":"asset:test/relationship_to_one.go.tpl"},{"name":"test/relationship_to_one_setops.go.tpl","loader":"asset:test/relationship_to_one_setops.go.tpl"},{"name":"test/reload.go.tpl","loader":"asset:test/reload.go.tpl"},{"name":"test/select.go.tpl","loader":"asset:test/select.go.tpl"},{"name":"test/singleton/boil_main_test.go.tpl","loader":"asset:test/singleton/boil_main_test.go.tpl"},{"name":"test/singleton/boil_queries_test.go.tpl","loader":"asset:test/singleton/boil_queries_test.go.tpl"},{"name":"test/singleton/boil_suites_test.go.tpl","loader":"asset:test/singleton/boil_suites_test.go.tpl"},{"name":"test/singleton/psql_main_test.go.tpl","loader":"base64:(sha256 of content): a10f31b033737bdec0142363f6661a201e39eee8201e6cd56f889278d9e05f80"},{"name":"test/singleton/psql_suites_test.go.tpl","loader":"base64:(sha256 of content): a89b312831433fa034ad26757c27224bad4cf17b2e1a89a31574c5da21f68fa7"},{"name":"test/types.go.tpl","loader":"asset:test/types.go.tpl"},{"name":"test/update.go.tpl","loader":"asset:test/update.go.tpl"},{"name":"test/upsert.go.tpl","loader":"base64:(sha256 of content): fbdedf7ee38269da51adf562f603fb1616cf5ac7975c53268a9181863b2c2258"}]}

Please provide a relevant database schema so we can replicate your issue (Provided you are comfortable sharing this)

create type order_status as enum (
    'awaiting_shipment',
    'partially_shipped',
    'completed',
    'shipped',
    'cancelled',
    'declined',
    'refunded',
    'disputed',
    'manual_verification_required',
    'partially_refunded'
    );



create table orders
(
    id                   serial primary key,
    stripe_payment_id    varchar(255) not null,
    stripe_session_id    varchar(255) not null,
    stripe_customer_id   varchar(255) not null,
    status               order_status not null,

    customer_email       varchar(255) not null,
    customer_first_name  varchar(255) not null,
    customer_last_name   varchar(255) not null,
    customer_phone       varchar(255) not null,

    shipping_city        varchar(255) not null,
    shipping_line1       varchar(255) not null,
    shipping_line2       varchar(255) not null,
    shipping_state       varchar(255) not null,
    shipping_country     varchar(255) not null,
    shipping_postal_code varchar(255) not null,

    created_at           timestamp without time zone default (now() at time zone 'utc'),
    updated_at           timestamp without time zone default (now() at time zone 'utc')
);

create unique index orders_unique_stripe
    on orders (stripe_payment_id, stripe_session_id, stripe_customer_id);



create table order_items
(
    id                serial primary key,
    title             varchar(255) not null       default '-',
    description       varchar(255) not null       default '-',
    order_id          integer      not null,
    stripe_product_id varchar(255) not null,
    quantity          int          not null,
    price             int          not null,
    image             varchar(255),
    created_at        timestamp without time zone default (now() at time zone 'utc'),
    updated_at        timestamp without time zone default (now() at time zone 'utc'),
    constraint fk_order_items_order_id foreign key (order_id) references orders (id)
        on delete cascade
        deferrable initially deferred
);

create table products
(
    id             serial primary key,
    title          varchar(255) not null,
    description    varchar(255) not null,
    features       hstore       not null,
    specifications hstore       not null,
    created_at     timestamp without time zone default (now() at time zone 'utc'),
    updated_at     timestamp without time zone default (now() at time zone 'utc')
);

create table product_variants
(
    id                serial primary key,
    product_id        integer      not null,
    stripe_product_id varchar(255) not null,
    stripe_price_id   varchar(255) not null,
    sku               varchar(8)   not null,
    quantity          int,
    price             int          not null, -- in cents
    attributes        hstore,
    created_at        timestamp without time zone default (now() at time zone 'utc'),
    updated_at        timestamp without time zone default (now() at time zone 'utc'),

    constraint fk_product_variants_product_id foreign key (product_id) references products (id)
        on delete cascade
        deferrable initially deferred
);

@stephenafamo
Copy link
Collaborator

Sorry about this, I would appreciate if you can send a PR to fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants