MCPcopy
hub / github.com/sqlc-dev/sqlc / TestUpdate

Function TestUpdate

internal/engine/sqlite/catalog_test.go:15–269  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestUpdate(t *testing.T) {
16 p := NewParser()
17
18 for i, tc := range []struct {
19 stmt string
20 s *catalog.Schema
21 }{
22 {
23 `
24 CREATE TABLE foo (bar text);
25 `,
26 &catalog.Schema{
27 Name: "main",
28 Tables: []*catalog.Table{
29 {
30 Rel: &ast.TableName{Name: "foo"},
31 Columns: []*catalog.Column{
32 {
33 Name: "bar",
34 Type: ast.TypeName{Name: "text"},
35 },
36 },
37 },
38 },
39 },
40 },
41 {
42 `
43 CREATE TABLE foo (bar text);
44 ALTER TABLE foo RENAME TO baz;
45 `,
46 &catalog.Schema{
47 Name: "main",
48 Tables: []*catalog.Table{
49 {
50 Rel: &ast.TableName{Name: "baz"},
51 Columns: []*catalog.Column{
52 {
53 Name: "bar",
54 Type: ast.TypeName{Name: "text"},
55 },
56 },
57 },
58 },
59 },
60 },
61 {
62 `
63 CREATE TABLE foo (bar text);
64 ALTER TABLE foo ADD COLUMN baz bool;
65 `,
66 &catalog.Schema{
67 Name: "main",
68 Tables: []*catalog.Table{
69 {
70 Rel: &ast.TableName{Name: "foo"},
71 Columns: []*catalog.Column{
72 {

Callers

nothing calls this directly

Calls 5

ParseMethod · 0.95
newTestCatalogFunction · 0.85
LogMethod · 0.80
BuildMethod · 0.80
NewParserFunction · 0.70

Tested by

no test coverage detected