Added additional string to configure update/delete actions
This commit is contained in:
@@ -31,7 +31,7 @@
|
|||||||
-type column_constraint() :: non_null | primary_key | {primary_key, pk_constraints()}
|
-type column_constraint() :: non_null | primary_key | {primary_key, pk_constraints()}
|
||||||
| unique | {default, sql_value()}.
|
| unique | {default, sql_value()}.
|
||||||
-type column_constraints() :: column_constraint() | [column_constraint()].
|
-type column_constraints() :: column_constraint() | [column_constraint()].
|
||||||
-type table_constraint() :: {primary_key, [atom()]} | {foreign_key, {[atom()], atom(), [atom()]}} | {unique, [atom()]}.
|
-type table_constraint() :: {primary_key, [atom()]} | {foreign_key, {[atom()], atom(), [atom()], string()}} | {unique, [atom()]}.
|
||||||
-type table_constraints() :: table_constraint() | [table_constraint()].
|
-type table_constraints() :: table_constraint() | [table_constraint()].
|
||||||
-type table_info() :: [{column_id(), sql_type()} | {column_id(), sql_type(), column_constraints()}].
|
-type table_info() :: [{column_id(), sql_type()} | {column_id(), sql_type(), column_constraints()}].
|
||||||
|
|
||||||
|
|||||||
@@ -376,14 +376,15 @@ table_constraint_sql(TableConstraint) ->
|
|||||||
{unique, Columns} ->
|
{unique, Columns} ->
|
||||||
["UNIQUE(",
|
["UNIQUE(",
|
||||||
map_intersperse(fun indexed_column_sql/1, Columns, ", "), ")"];
|
map_intersperse(fun indexed_column_sql/1, Columns, ", "), ")"];
|
||||||
{foreign_key, {Columns, Parent, ParentColumns}} ->
|
{foreign_key, {Columns, Parent, ParentColumns, Action}} ->
|
||||||
["FOREIGN KEY(",
|
["FOREIGN KEY(",
|
||||||
map_intersperse(fun indexed_column_sql/1, Columns, ", "),
|
map_intersperse(fun indexed_column_sql/1, Columns, ", "),
|
||||||
") REFERENCES ",
|
") REFERENCES ",
|
||||||
atom_to_list(Parent),
|
atom_to_list(Parent),
|
||||||
"(",
|
"(",
|
||||||
map_intersperse(fun indexed_column_sql/1, ParentColumns, ", "),
|
map_intersperse(fun indexed_column_sql/1, ParentColumns, ", "),
|
||||||
")"];
|
")",
|
||||||
|
Action];
|
||||||
{raw, S} when is_list(S) -> S;
|
{raw, S} when is_list(S) -> S;
|
||||||
_ when is_list(TableConstraint) ->
|
_ when is_list(TableConstraint) ->
|
||||||
map_intersperse(fun table_constraint_sql/1, TableConstraint, ", ")
|
map_intersperse(fun table_constraint_sql/1, TableConstraint, ", ")
|
||||||
|
|||||||
Reference in New Issue
Block a user