From ef2afbeea066f9d187e50f18dd00f66fe40bace5 Mon Sep 17 00:00:00 2001 From: Juan Manuel Castillo <42351046+juancastillo0@users.noreply.github.com> Date: Wed, 6 Dec 2023 23:01:26 -0500 Subject: [PATCH] autoincrement generated and optional for has default generated config --- .../wasm_packages/sql_parser/typesql/lib/src/sql_types.dart | 2 ++ .../typesql_generator/lib/src/typesql_generator_base.dart | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/wasm_packages/sql_parser/typesql/lib/src/sql_types.dart b/packages/wasm_packages/sql_parser/typesql/lib/src/sql_types.dart index 92e28e2..af65232 100644 --- a/packages/wasm_packages/sql_parser/typesql/lib/src/sql_types.dart +++ b/packages/wasm_packages/sql_parser/typesql/lib/src/sql_types.dart @@ -759,6 +759,8 @@ class SqlTypeFinder { ColumnOptionCheck() => null, ColumnOptionComment() => null, ColumnOptionGenerated() => generated = true, + ColumnOptionDialectSpecific(:final value) => generated = generated || + const ['AUTOINCREMENT', 'AUTO_INCREMENT'].contains(value), _ => null, }); } diff --git a/packages/wasm_packages/sql_parser/typesql_generator/lib/src/typesql_generator_base.dart b/packages/wasm_packages/sql_parser/typesql_generator/lib/src/typesql_generator_base.dart index cf3ab77..bcc51a1 100644 --- a/packages/wasm_packages/sql_parser/typesql_generator/lib/src/typesql_generator_base.dart +++ b/packages/wasm_packages/sql_parser/typesql_generator/lib/src/typesql_generator_base.dart @@ -128,7 +128,7 @@ class ${ReCase(fileName).pascalCase}Queries { ); final fields = t.value.fields .map((e) => - "(name: '${e.name}', type: ${e.type.instantiation}, hasDefault: ${e.defaultValue != null})") + "(name: '${e.name}', type: ${e.type.instantiation}, hasDefault: ${e.optional || e.defaultValue != null})") .join(','); final generics = '<${className}, ${addedUpdate ?? className}>';