{
  "scenarios": [
    {
      "type": "create",
      "name": "Create Table For Publication",
      "endpoint": "NODE-table.obj",
      "sql_endpoint": "NODE-table.sql_id",
      "data": {
        "name": "test_table_publication",
        "columns": [
          {
            "name": "emp_id",
            "cltype": "integer",
            "is_primary_key": true
          },
          {
            "name": "name",
            "cltype": "text"
          },
          {
            "name": "salary",
            "cltype": "bigint"
          }
        ],
        "is_partitioned": false,
        "schema": "public",
        "spcname": "pg_default"
      },
      "store_object_id": true
    },
    {
      "type": "create",
      "name": "Create Second Table For Publication",
      "endpoint": "NODE-table.obj",
      "sql_endpoint": "NODE-table.sql_id",
      "data": {
        "name": "test_table_publication_2",
        "columns": [
          {
            "name": "dept_id",
            "cltype": "integer",
            "is_primary_key": true
          },
          {
            "name": "dept_name",
            "cltype": "text"
          }
        ],
        "is_partitioned": false,
        "schema": "public",
        "spcname": "pg_default"
      },
      "store_object_id": true
    },
    {
      "type": "create",
      "name": "Create Schema For Publication",
      "endpoint": "NODE-schema.obj",
      "sql_endpoint": "NODE-schema.sql_id",
      "data": {
        "name": "test_schema_publication"
      },
      "store_object_id": true
    },
    {
      "type": "create",
      "name": "Create Second Schema For Publication",
      "endpoint": "NODE-schema.obj",
      "sql_endpoint": "NODE-schema.sql_id",
      "data": {
        "name": "test_schema_publication_2"
      },
      "store_object_id": true
    },
    {
      "type": "create",
      "name": "Create  Publication for all tables with insert and update",
      "endpoint": "NODE-publication.obj",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql",
      "data": {
        "name": "test_publication_create",
        "evnt_insert": true,
        "evnt_update": true,
        "evnt_delete": false,
        "evnt_truncate": false,
        "pubowner": "<OWNER>",
        "publish_via_partition_root": false,
        "all_table": true,
        "only_table": false,
        "pubtable": "",
        "pubschema": ""
      },
      "expected_sql_file": "create_publication.sql",
      "expected_msql_file": "create_publication_msql.sql"
    },
    {
      "type": "alter",
      "name": "Alter  Publication name for all tables",
      "endpoint": "NODE-publication.obj_id",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql_id",
      "data": {
        "name": "alterd_publication"
      },
      "expected_sql_file": "alter_publication.sql",
      "expected_msql_file": "alter_publication_msql.sql"
    },
    {
      "type": "alter",
      "name": "Alter  Publication event for all tables",
      "endpoint": "NODE-publication.obj_id",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql_id",
      "data": {
        "evnt_delete": true,
        "evnt_truncate": true
      },
      "expected_sql_file": "alter_publication_event.sql",
      "expected_msql_file": "alter_publication_event_msql.sql"
    },
    {
      "type": "delete",
      "name": "Drop publication for all tables",
      "endpoint": "NODE-publication.delete_id",
      "data": {
        "name": "alterd_publication"
      }
    },
    {
      "type": "create",
      "name": "Create Publication for few tables",
      "endpoint": "NODE-publication.obj",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql",
      "data": {
        "name": "test_publication_create",
        "evnt_insert": true,
        "evnt_update": true,
        "evnt_delete": true,
        "evnt_truncate": true,
        "pubowner": "<OWNER>",
        "publish_via_partition_root": false,
        "all_table": false,
        "only_table": false,
        "pubtable": [
          {
            "table_name": "public.test_table_publication"
          }
        ],
        "pubschema": ""
      },
      "expected_sql_file": "create_publication_few_tables.sql",
      "expected_msql_file": "create_publication_few_tables_msql.sql"
    },
    {
      "type": "alter",
      "name": "Alter  Publication for few tables via adding new tables",
      "endpoint": "NODE-publication.obj_id",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql_id",
      "data": {
        "pubtable": {
          "added": [
            {
              "table_name": "public.test_table_publication_2"
            }
          ]
        }
      },
      "expected_sql_file": "alter_publication_add_tables.sql",
      "expected_msql_file": "alter_publication_add_tables_msql.sql"
    },
    {
      "type": "alter",
      "name": "Alter  Publication for few tables via deleting tables with",
      "endpoint": "NODE-publication.obj_id",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql_id",
      "data": {
        "pubtable": {
          "deleted": [
            {
              "table_name": "public.test_table_publication_2"
            }
          ]
        }
      },
      "expected_sql_file": "alter_publication_drop_tables.sql",
      "expected_msql_file": "alter_publication_drop_tables_msql.sql"
    },
    {
      "type": "alter",
      "name": "Alter  Publication for few tables via adding new tables with columns",
      "endpoint": "NODE-publication.obj_id",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql_id",
      "data": {
        "pubtable": {
          "added": [
            {
              "table_name": "public.test_table_publication_2",
              "columns": [
                "dept_id"
              ]
            }
          ]
        }
      },
      "expected_sql_file": "alter_publication_add_tables_columns.sql",
      "expected_msql_file": "alter_publication_add_tables_columns_msql.sql"
    },
    {
      "type": "alter",
      "name": "Alter  Publication for few tables via updating tables with columns",
      "endpoint": "NODE-publication.obj_id",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql_id",
      "data": {
        "pubtable": {
          "changed": [
            {
              "table_name": "public.test_table_publication_2",
              "columns": [
                "dept_name"
              ]
            }
          ]
        }
      },
      "expected_sql_file": "alter_publication_set_tables_columns.sql",
      "expected_msql_file": "alter_publication_set_tables_columns_msql.sql"
    },
    {
      "type": "alter",
      "name": "Alter  Publication for few tables via deleting tables with",
      "endpoint": "NODE-publication.obj_id",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql_id",
      "data": {
        "pubtable": {
          "deleted": [
            {
              "table_name": "public.test_table_publication_2"
            }
          ]
        }
      },
      "expected_sql_file": "alter_publication_drop_tables.sql",
      "expected_msql_file": "alter_publication_drop_tables_msql.sql"
    },
    {
      "type": "alter",
      "name": "Alter  Publication for few tables via adding new tables with where",
      "endpoint": "NODE-publication.obj_id",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql_id",
      "data": {
        "pubtable": {
          "added": [
            {
              "table_name": "public.test_table_publication_2",
              "where": "dept_id=2"
            }
          ]
        }
      },
      "expected_sql_file": "alter_publication_add_tables_where.sql",
      "expected_msql_file": "alter_publication_add_tables_where_msql.sql"
    },
    {
      "type": "alter",
      "name": "Alter  Publication for few tables via updating tables with where",
      "endpoint": "NODE-publication.obj_id",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql_id",
      "data": {
        "pubtable": {
          "changed": [
            {
              "table_name": "public.test_table_publication_2",
              "where": "dept_name='test'"
            }
          ]
        }
      },
      "expected_sql_file": "alter_publication_set_tables_where.sql",
      "expected_msql_file": "alter_publication_set_tables_where_msql.sql"
    },
    {
      "type": "alter",
      "name": "Alter  Publication for few tables via deleting tables with",
      "endpoint": "NODE-publication.obj_id",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql_id",
      "data": {
        "pubtable": {
          "deleted": [
            {
              "table_name": "public.test_table_publication_2"
            }
          ]
        }
      },
      "expected_sql_file": "alter_publication_drop_tables.sql",
      "expected_msql_file": "alter_publication_drop_tables_msql.sql"
    },
    {
      "type": "alter",
      "name": "Alter  Publication for few tables via adding new tables with columns and where",
      "endpoint": "NODE-publication.obj_id",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql_id",
      "data": {
        "pubtable": {
          "added": [
            {
              "table_name": "public.test_table_publication_2",
              "columns": [
                "dept_id"
              ],
              "where": "dept_id=2"
            }
          ]
        }
      },
      "expected_sql_file": "alter_publication_add_tables_columns_where.sql",
      "expected_msql_file": "alter_publication_add_tables_columns_where_msql.sql"
    },
    {
      "type": "alter",
      "name": "Alter  Publication for few tables via updating tables with columns and where",
      "endpoint": "NODE-publication.obj_id",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql_id",
      "data": {
        "pubtable": {
          "changed": [
            {
              "table_name": "public.test_table_publication_2",
              "columns": [
                "dept_name"
              ],
              "where": "dept_name='test'"
            }
          ]
        }
      },
      "expected_sql_file": "alter_publication_set_tables_columns_where.sql",
      "expected_msql_file": "alter_publication_set_tables_columns_where_msql.sql"
    },
    {
      "type": "delete",
      "name": "Drop publication for few tables",
      "endpoint": "NODE-publication.delete_id",
      "data": {
        "name": "test_publication_create"
      }
    },
    {
      "type": "create",
      "name": "Create  Publication for few schemas",
      "endpoint": "NODE-publication.obj",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql",
      "data": {
        "name": "test_publication_create",
        "evnt_insert": true,
        "evnt_update": true,
        "evnt_delete": true,
        "evnt_truncate": true,
        "pubowner": "<OWNER>",
        "publish_via_partition_root": false,
        "all_table": false,
        "only_table": false,
        "pubtable": "",
        "pubschema": [
          "test_schema_publication"
        ]
      },
      "expected_sql_file": "create_publication_few_schemas.sql",
      "expected_msql_file": "create_publication_few_schemas_msql.sql"
    },
    {
      "type": "alter",
      "name": "Alter  Publication for few schemas via adding new schemas",
      "endpoint": "NODE-publication.obj_id",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql_id",
      "data": {
        "pubschema": [
          "test_schema_publication",
          "test_schema_publication_2"
        ]
      },
      "expected_sql_file": "alter_publication_add_schemas.sql",
      "expected_msql_file": "alter_publication_add_schemas_msql.sql"
    },
    {
      "type": "alter",
      "name": "Alter  Publication for few schemas via deleting schemas",
      "endpoint": "NODE-publication.obj_id",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql_id",
      "data": {
        "pubschema": [
          "test_schema_publication_2"
        ]
      },
      "expected_sql_file": "alter_publication_drop_schemas.sql",
      "expected_msql_file": "alter_publication_drop_schemas_msql.sql"
    },
    {
      "type": "delete",
      "name": "Drop publication for few schemas",
      "endpoint": "NODE-publication.delete_id",
      "data": {
        "name": "test_publication_create"
      }
    },
    {
      "type": "create",
      "name": "Create  Publication for few tables with only",
      "endpoint": "NODE-publication.obj",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql",
      "data": {
        "name": "test_publication_create",
        "evnt_insert": true,
        "evnt_update": true,
        "evnt_delete": true,
        "evnt_truncate": true,
        "pubowner": "<OWNER>",
        "publish_via_partition_root": false,
        "all_table": false,
        "only_table": true,
        "pubtable": [
          {
            "table_name": "public.test_table_publication"
          }
        ],
        "pubschema": ""
      },
      "expected_sql_file": "create_publication_few_tables_only.sql",
      "expected_msql_file": "create_publication_few_tables_only_msql.sql"
    },
    {
      "type": "delete",
      "name": "Drop publication for few tables with only",
      "endpoint": "NODE-publication.delete_id",
      "data": {
        "name": "test_publication_create"
      }
    },
    {
      "type": "create",
      "name": "Create  Publication for few tables and few schemas",
      "endpoint": "NODE-publication.obj",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql",
      "data": {
        "name": "test_publication_create",
        "evnt_insert": true,
        "evnt_update": true,
        "evnt_delete": true,
        "evnt_truncate": true,
        "pubowner": "<OWNER>",
        "publish_via_partition_root": false,
        "all_table": false,
        "only_table": false,
        "pubtable": [
          {
            "table_name": "public.test_table_publication"
          }
        ],
        "pubschema": [
          "test_schema_publication"
        ]
      },
      "expected_sql_file": "create_publication_few_tables_schemas.sql",
      "expected_msql_file": "create_publication_few_tables_schemas_msql.sql"
    },
    {
      "type": "delete",
      "name": "Drop publication for few tables and few schemas",
      "endpoint": "NODE-publication.delete_id",
      "data": {
        "name": "test_publication_create"
      }
    },
    {
      "type": "create",
      "name": "Create  Publication for few tables with columns",
      "endpoint": "NODE-publication.obj",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql",
      "data": {
        "name": "test_publication_create",
        "evnt_insert": true,
        "evnt_update": true,
        "evnt_delete": true,
        "evnt_truncate": true,
        "pubowner": "<OWNER>",
        "publish_via_partition_root": false,
        "all_table": false,
        "only_table": false,
        "pubtable": [
          {
            "table_name": "public.test_table_publication",
            "columns": [
              "emp_id",
              "name"
            ]
          }
        ],
        "pubschema": ""
      },
      "expected_sql_file": "create_publication_few_tables_columns.sql",
      "expected_msql_file": "create_publication_few_tables_columns_msql.sql"
    },
    {
      "type": "delete",
      "name": "Drop publication for few tables with columns",
      "endpoint": "NODE-publication.delete_id",
      "data": {
        "name": "test_publication_create"
      }
    },
    {
      "type": "create",
      "name": "Create  Publication for few tables with where",
      "endpoint": "NODE-publication.obj",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql",
      "data": {
        "name": "test_publication_create",
        "evnt_insert": true,
        "evnt_update": true,
        "evnt_delete": true,
        "evnt_truncate": true,
        "pubowner": "<OWNER>",
        "publish_via_partition_root": false,
        "all_table": false,
        "only_table": false,
        "pubtable": [
          {
            "table_name": "public.test_table_publication",
            "where": "emp_id=2 and name='test'"
          }
        ],
        "pubschema": ""
      },
      "expected_sql_file": "create_publication_few_tables_where.sql",
      "expected_msql_file": "create_publication_few_tables_where_msql.sql"
    },
    {
      "type": "delete",
      "name": "Drop publication for few tables with where",
      "endpoint": "NODE-publication.delete_id",
      "data": {
        "name": "test_publication_create"
      }
    },
    {
      "type": "create",
      "name": "Create  Publication for few tables with columns and where",
      "endpoint": "NODE-publication.obj",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql",
      "data": {
        "name": "test_publication_create",
        "evnt_insert": true,
        "evnt_update": true,
        "evnt_delete": true,
        "evnt_truncate": true,
        "pubowner": "<OWNER>",
        "publish_via_partition_root": false,
        "all_table": false,
        "only_table": false,
        "pubtable": [
          {
            "table_name": "public.test_table_publication",
            "columns": [
              "emp_id",
              "name"
            ],
            "where": "emp_id=2 and name='test'"
          }
        ],
        "pubschema": ""
      },
      "expected_sql_file": "create_publication_few_tables_columns_where.sql",
      "expected_msql_file": "create_publication_few_tables_columns_where_msql.sql"
    },
    {
      "type": "delete",
      "name": "Drop publication for few tables with columns and where",
      "endpoint": "NODE-publication.delete_id",
      "data": {
        "name": "test_publication_create"
      }
    },
    {
      "type": "create",
      "name": "Create  Publication for few tables with where and few schemas",
      "endpoint": "NODE-publication.obj",
      "sql_endpoint": "NODE-publication.sql_id",
      "msql_endpoint": "NODE-publication.msql",
      "data": {
        "name": "test_publication_create",
        "evnt_insert": true,
        "evnt_update": true,
        "evnt_delete": true,
        "evnt_truncate": true,
        "pubowner": "<OWNER>",
        "publish_via_partition_root": false,
        "all_table": false,
        "only_table": false,
        "pubtable": [
          {
            "table_name": "public.test_table_publication",
            "where": "emp_id=2 and name='test'"
          }
        ],
        "pubschema": [
          "test_schema_publication"
        ]
      },
      "expected_sql_file": "create_publication_few_tables_where_schemas.sql",
      "expected_msql_file": "create_publication_few_tables_where_schemas_msql.sql"
    },
    {
      "type": "delete",
      "name": "Drop publication for few tables with where and few schemas",
      "endpoint": "NODE-publication.delete_id",
      "data": {
        "name": "test_publication_create"
      }
    }
  ]
}
