dialect/sql/schema: sqlite support for uuid type

Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/177

Reviewed By: alexsn

Differential Revision: D18615595

fbshipit-source-id: b3167a0aa9260cdf22d88dd7e45c7ebfae1909d5
This commit is contained in:
Ariel Mashraki
2019-11-20 09:47:48 -08:00
committed by Facebook Github Bot
parent db7b05ad04
commit f7dac21972
2 changed files with 4 additions and 1 deletions

View File

@@ -62,6 +62,7 @@ func TestSQLite_Create(t *testing.T) {
{Name: "name", Type: field.TypeString, Nullable: true},
{Name: "age", Type: field.TypeInt},
{Name: "doc", Type: field.TypeJSON, Nullable: true},
{Name: "uuid", Type: field.TypeUUID, Nullable: true},
},
},
},
@@ -72,7 +73,7 @@ func TestSQLite_Create(t *testing.T) {
mock.ExpectQuery(escape("SELECT COUNT(*) FROM `sqlite_master` WHERE `type` = ? AND `name` = ?")).
WithArgs("table", "users").
WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(0))
mock.ExpectExec(escape("CREATE TABLE `users`(`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `name` varchar(255) NULL, `age` integer NOT NULL, `doc` json NULL)")).
mock.ExpectExec(escape("CREATE TABLE `users`(`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `name` varchar(255) NULL, `age` integer NOT NULL, `doc` json NULL, `uuid` uuid NULL)")).
WillReturnResult(sqlmock.NewResult(0, 1))
mock.ExpectCommit()
},