(t *testing.T)
| 16 | ) |
| 17 | |
| 18 | func 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"}, |
nothing calls this directly
no test coverage detected