mirror of
https://github.com/ent/ent.git
synced 2026-05-03 08:00:58 +03:00
entc/gen: change name format for edge fks (#286)
* entc/gen: change name format for edge fks * dialect/sql/schema: add fixture support for mysql and postgres * sql/dialect: merge fkcolumn queries to one for the 2 dialects
This commit is contained in:
@@ -564,6 +564,11 @@ func TestPostgres_Create(t *testing.T) {
|
||||
mock.ExpectQuery(escape(fmt.Sprintf(indexesQuery, "users"))).
|
||||
WillReturnRows(sqlmock.NewRows([]string{"index_name", "column_name", "primary", "unique", "seq_in_index"}).
|
||||
AddRow("users_pkey", "id", "t", "t", 0))
|
||||
|
||||
mock.ExpectQuery(escape(`SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE "table_schema" = CURRENT_SCHEMA() AND "constraint_type" = $1 AND "constraint_name" = $2`)).
|
||||
WithArgs("FOREIGN KEY", "user_spouse____________________390ed76f91d3c57cd3516e7690f621dc").
|
||||
WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(0))
|
||||
|
||||
mock.ExpectExec(escape(`ALTER TABLE "users" ADD COLUMN "spouse_id" bigint NULL`)).
|
||||
WillReturnResult(sqlmock.NewResult(0, 1))
|
||||
mock.ExpectQuery(escape(`SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE "table_schema" = CURRENT_SCHEMA() AND "constraint_type" = $1 AND "constraint_name" = $2`)).
|
||||
|
||||
Reference in New Issue
Block a user