[DBIx-Class-Devel] [dbsrgits/sql-translator] Table with wrong type could be created (Issue #157)

Eugen Konkov notifications at github.com
Sat Apr 8 02:56:17 GMT 2023


How to reproduce: put space before type.

```diff
--- a/lib/Schema/Result/Document.pm
+++ b/lib/Schema/Result/Document.pm
@@ -21,7 +21,7 @@ $X->add_columns(
 		is_nullable =>  1,
 	},
 	document_type_id => {
-		data_type =>  'integer',
+		data_type =>  ' integer',
 	},
 	docn => {
 		data_type =>  'varchar',
```

Generated migration script (Notice extra space before integer for `document_type_id` column):
```sql
CREATE TABLE "document" (
  "id" serial NOT NULL,
  "owner_id" integer,
  "document_type_id"  integer NOT NULL,
  PRIMARY KEY ("id")
);
```

I do not know how long this wrong data type lurking at production code. But we noticed it when started to use 'Mojolicious::Plugin::GraphQL', which issues `'document_type_id' unknown data type:  integer` error.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/dbsrgits/sql-translator/issues/157
You are receiving this because you are subscribed to this thread.

Message ID: <dbsrgits/sql-translator/issues/157 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class-devel/attachments/20230407/df5ffc1a/attachment.htm>


More information about the DBIx-Class-Devel mailing list