MCPcopy Index your code
hub / github.com/bytebase/bytebase / TestSyncerForPostgreSQL

Function TestSyncerForPostgreSQL

backend/tests/syncer_test.go:18–250  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

16)
17
18func TestSyncerForPostgreSQL(t *testing.T) {
19 const (
20 databaseName = "test_sync_postgresql_schema_db"
21 createSchema = `
22 CREATE SCHEMA schema1;
23 CREATE TABLE schema1.trd (
24 "A" int DEFAULT NULL,
25 "B" int DEFAULT NULL,
26 c int DEFAULT NULL,
27 UNIQUE ("A","B",c)
28 );
29 CREATE TABLE "TFK" (
30 a int DEFAULT NULL,
31 b int DEFAULT NULL,
32 c int DEFAULT NULL,
33 CONSTRAINT tfk_ibfk_1 FOREIGN KEY (a, b, c) REFERENCES schema1.trd ("A", "B", c)
34 );
35 CREATE VIEW "VW" AS SELECT * FROM "TFK";
36 `
37 )
38 wantDatabaseMetadata := &v1pb.DatabaseMetadata{
39 Name: "instances/instance-syncer-postgres/databases/test_sync_postgresql_schema_db/metadata",
40 Owner: "bytebase",
41 CharacterSet: "UTF8",
42 Collation: "en_US.UTF-8",
43 Schemas: []*v1pb.SchemaMetadata{
44 {
45 Name: "public",
46 Owner: "pg_database_owner",
47 Comment: "standard public schema",
48 Tables: []*v1pb.TableMetadata{
49 {
50 Name: "TFK",
51 Owner: "bytebase",
52 Columns: []*v1pb.ColumnMetadata{
53 {
54 Name: "a",
55 Position: 1,
56 Nullable: true,
57 Type: "integer",
58 },
59 {
60 Name: "b",
61 Position: 2,
62 Nullable: true,
63 Type: "integer",
64 },
65 {
66 Name: "c",
67 Position: 3,
68 Nullable: true,
69 Type: "integer",
70 },
71 },
72 ForeignKeys: []*v1pb.ForeignKeyMetadata{
73 {
74 Name: "tfk_ibfk_1",
75 Columns: []string{"a", "b", "c"},

Callers

nothing calls this directly

Calls 12

CloseMethod · 0.95
createDatabaseMethod · 0.95
changeDatabaseMethod · 0.95
getPgContainerFunction · 0.85
JoinMethod · 0.80
CloseMethod · 0.65
PingMethod · 0.65
CreateInstanceMethod · 0.65
GetDatabaseMethod · 0.65
CreateSheetMethod · 0.65
GetDatabaseMetadataMethod · 0.65

Tested by

no test coverage detected