(t *testing.T)
| 22 | } |
| 23 | |
| 24 | func TestBuildExportTableDDLCanonicalPrimaryKey(t *testing.T) { |
| 25 | db := &MssqlDatabase{} |
| 26 | db.SetGeneratorConfig(database.GeneratorConfig{LegacyIgnoreQuotes: false}) |
| 27 | |
| 28 | ddl := db.buildExportTableDDL( |
| 29 | "dbo.SystemUser", |
| 30 | []column{ |
| 31 | {Name: "SystemUserId", dataType: "int", Nullable: false}, |
| 32 | {Name: "Date", dataType: "date", Nullable: false}, |
| 33 | }, |
| 34 | []*indexDef{ |
| 35 | { |
| 36 | name: "PK_SystemUser", |
| 37 | columns: []string{"[SystemUserId]"}, |
| 38 | primary: true, |
| 39 | constraint: true, |
| 40 | indexType: "CLUSTERED", |
| 41 | }, |
| 42 | }, |
| 43 | nil, |
| 44 | nil, |
| 45 | ) |
| 46 | |
| 47 | if !strings.Contains(ddl, "CONSTRAINT [PK_SystemUser] PRIMARY KEY CLUSTERED ([SystemUserId])") { |
| 48 | t.Fatalf("expected canonical bracketed PK constraint and column in export, got:\n%s", ddl) |
| 49 | } |
| 50 | if !strings.Contains(ddl, "[Date] date NOT NULL") { |
| 51 | t.Fatalf("expected reserved identifier to remain bracketed in export, got:\n%s", ddl) |
| 52 | } |
| 53 | } |
nothing calls this directly
no test coverage detected