mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-24 09:40:21 -06:00
Added support of Collation, FTS Configuration, FTS Dictionary, FTS Parser, and FTS Template to the Schema Diff. Fixes #5261
This commit is contained in:
parent
6105fc861d
commit
4fe69e825e
@ -9,6 +9,7 @@ This release contains a number of bug fixes and new features since the release o
|
||||
New features
|
||||
************
|
||||
|
||||
| `Issue #5261 <https://redmine.postgresql.org/issues/5261>`_ - Added support of Collation, FTS Configuration, FTS Dictionary, FTS Parser, and FTS Template to the Schema Diff.
|
||||
|
||||
Housekeeping
|
||||
************
|
||||
|
@ -501,7 +501,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
|
||||
@check_precondition
|
||||
def delete(self, gid, sid, did, scid, coid=None):
|
||||
def delete(self, gid, sid, did, scid, coid=None, only_sql=False):
|
||||
"""
|
||||
This function will delete existing the collation object
|
||||
|
||||
@ -511,6 +511,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
did: Database ID
|
||||
scid: Schema ID
|
||||
coid: Collation ID
|
||||
only_sql: Return only sql if True
|
||||
"""
|
||||
if coid is None:
|
||||
data = request.form if request.form else json.loads(
|
||||
@ -548,6 +549,11 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
nspname=data['schema'],
|
||||
cascade=cascade,
|
||||
conn=self.conn)
|
||||
|
||||
# Used for schema diff tool
|
||||
if only_sql:
|
||||
return SQL
|
||||
|
||||
status, res = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
@ -685,7 +691,8 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return SQL.strip('\n'), data['name']
|
||||
|
||||
@check_precondition
|
||||
def sql(self, gid, sid, did, scid, coid):
|
||||
def sql(self, gid, sid, did, scid, coid, diff_schema=None,
|
||||
json_resp=True):
|
||||
"""
|
||||
This function will generates reverse engineered sql for collation
|
||||
object
|
||||
@ -696,6 +703,8 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
did: Database ID
|
||||
scid: Schema ID
|
||||
coid: Collation ID
|
||||
diff_schema: Target Schema for schema diff
|
||||
json_resp: True then return json response
|
||||
"""
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
@ -710,6 +719,9 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
data = res['rows'][0]
|
||||
|
||||
if diff_schema:
|
||||
data['schema'] = diff_schema
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'create.sql']),
|
||||
data=data, conn=self.conn)
|
||||
@ -722,6 +734,9 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
nspname=data['schema'])
|
||||
SQL = sql_header + '\n\n' + SQL.strip('\n')
|
||||
|
||||
if not json_resp:
|
||||
return SQL
|
||||
|
||||
return ajax_response(response=SQL)
|
||||
|
||||
@check_precondition
|
||||
@ -793,5 +808,38 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
return res
|
||||
|
||||
def get_sql_from_diff(self, gid, sid, did, scid, oid, data=None,
|
||||
diff_schema=None, drop_sql=False):
|
||||
"""
|
||||
This function is used to get the DDL/DML statements.
|
||||
:param gid: Group ID
|
||||
:param sid: Serve ID
|
||||
:param did: Database ID
|
||||
:param scid: Schema ID
|
||||
:param oid: Collation ID
|
||||
:param data: Difference data
|
||||
:param diff_schema: Target Schema
|
||||
:param drop_sql: True if need to drop the collation
|
||||
:return:
|
||||
"""
|
||||
sql = ''
|
||||
if data:
|
||||
if diff_schema:
|
||||
data['schema'] = diff_schema
|
||||
sql, name = self.get_sql(gid=gid, sid=sid, data=data, scid=scid,
|
||||
coid=oid)
|
||||
else:
|
||||
if drop_sql:
|
||||
sql = self.delete(gid=gid, sid=sid, did=did,
|
||||
scid=scid, coid=oid, only_sql=True)
|
||||
elif diff_schema:
|
||||
sql = self.sql(gid=gid, sid=sid, did=did, scid=scid, coid=oid,
|
||||
diff_schema=diff_schema, json_resp=False)
|
||||
else:
|
||||
sql = self.sql(gid=gid, sid=sid, did=did, scid=scid, coid=oid,
|
||||
json_resp=False)
|
||||
return sql
|
||||
|
||||
|
||||
SchemaDiffRegistry(blueprint.node_type, CollationView)
|
||||
CollationView.register_node_view(blueprint)
|
||||
|
@ -1,5 +1,23 @@
|
||||
{% if data %}
|
||||
{# Change object's owner #}
|
||||
{% if (data.lc_collate and data.lc_type) or data.locale or data.copy_collation %}
|
||||
-- WARNING:
|
||||
-- We have found the difference in either of LC_COLLATE or LC_CTYPE or LOCALE,
|
||||
-- so we need to drop the existing collation first and re-create it.
|
||||
DROP COLLATION {{ conn|qtIdent(o_data.schema, o_data.name) }};
|
||||
|
||||
CREATE COLLATION {{ conn|qtIdent(o_data.schema, o_data.name) }}
|
||||
{% if data.lc_collate and data.lc_type %}
|
||||
(LC_COLLATE = {{ data.lc_collate|qtLiteral }}, LC_CTYPE = {{ data.lc_type|qtLiteral }});
|
||||
{% endif %}
|
||||
{% if data.locale %}
|
||||
(LOCALE = {{ data.locale|qtLiteral }});
|
||||
{% endif %}
|
||||
{% if data.copy_collation %}
|
||||
FROM {{ data.copy_collation }};
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
{% if data.owner and data.owner != o_data.owner %}
|
||||
ALTER COLLATION {{ conn|qtIdent(o_data.schema, o_data.name) }}
|
||||
OWNER TO {{ conn|qtIdent(data.owner) }};
|
||||
|
@ -532,7 +532,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
|
||||
@check_precondition
|
||||
def delete(self, gid, sid, did, scid, cfgid=None):
|
||||
def delete(self, gid, sid, did, scid, cfgid=None, only_sql=False):
|
||||
"""
|
||||
This function will drop the FTS Configuration object
|
||||
:param gid: group id
|
||||
@ -540,6 +540,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:param did: database id
|
||||
:param scid: schema id
|
||||
:param cfgid: FTS Configuration id
|
||||
:param only_sql: Return only sql if True
|
||||
"""
|
||||
if cfgid is None:
|
||||
data = request.form if request.form else json.loads(
|
||||
@ -587,6 +588,10 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
cascade=cascade
|
||||
)
|
||||
|
||||
# Used for schema diff tool
|
||||
if only_sql:
|
||||
return sql
|
||||
|
||||
status, res = self.conn.execute_scalar(sql)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
@ -869,7 +874,8 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
|
||||
@check_precondition
|
||||
def sql(self, gid, sid, did, scid, cfgid):
|
||||
def sql(self, gid, sid, did, scid, cfgid, diff_schema=None,
|
||||
json_resp=True):
|
||||
"""
|
||||
This function will reverse generate sql for sql panel
|
||||
:param gid: group id
|
||||
@ -877,6 +883,8 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:param did: database id
|
||||
:param scid: schema id
|
||||
:param cfgid: FTS Configuration id
|
||||
:param diff_schema: Target Schema for schema diff
|
||||
:param json_resp: True then return json response
|
||||
"""
|
||||
try:
|
||||
sql = render_template(
|
||||
@ -901,6 +909,25 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"FTS Configuration node.")
|
||||
)
|
||||
|
||||
# Used for schema diff tool
|
||||
if diff_schema:
|
||||
data = {'schema': scid}
|
||||
# Fetch schema name from schema oid
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'schema.sql']),
|
||||
data=data,
|
||||
conn=self.conn,
|
||||
)
|
||||
|
||||
status, schema = self.conn.execute_scalar(sql)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=schema)
|
||||
|
||||
res = res.replace(schema, diff_schema)
|
||||
|
||||
if not json_resp:
|
||||
return res
|
||||
|
||||
return ajax_response(response=res)
|
||||
|
||||
except Exception as e:
|
||||
@ -970,5 +997,38 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
return res
|
||||
|
||||
def get_sql_from_diff(self, gid, sid, did, scid, oid, data=None,
|
||||
diff_schema=None, drop_sql=False):
|
||||
"""
|
||||
This function is used to get the DDL/DML statements.
|
||||
:param gid: Group ID
|
||||
:param sid: Serve ID
|
||||
:param did: Database ID
|
||||
:param scid: Schema ID
|
||||
:param oid: Collation ID
|
||||
:param data: Difference data
|
||||
:param diff_schema: Target Schema
|
||||
:param drop_sql: True if need to drop the fts configuration
|
||||
:return:
|
||||
"""
|
||||
sql = ''
|
||||
if data:
|
||||
if diff_schema:
|
||||
data['schema'] = diff_schema
|
||||
sql, name = self.get_sql(gid=gid, sid=sid, did=did, scid=scid,
|
||||
data=data, cfgid=oid)
|
||||
else:
|
||||
if drop_sql:
|
||||
sql = self.delete(gid=gid, sid=sid, did=did,
|
||||
scid=scid, cfgid=oid, only_sql=True)
|
||||
elif diff_schema:
|
||||
sql = self.sql(gid=gid, sid=sid, did=did, scid=scid, cfgid=oid,
|
||||
diff_schema=diff_schema, json_resp=False)
|
||||
else:
|
||||
sql = self.sql(gid=gid, sid=sid, did=did, scid=scid, cfgid=oid,
|
||||
json_resp=False)
|
||||
return sql
|
||||
|
||||
|
||||
SchemaDiffRegistry(blueprint.node_type, FtsConfigurationView)
|
||||
FtsConfigurationView.register_node_view(blueprint)
|
||||
|
@ -527,7 +527,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
|
||||
@check_precondition
|
||||
def delete(self, gid, sid, did, scid, dcid=None):
|
||||
def delete(self, gid, sid, did, scid, dcid=None, only_sql=False):
|
||||
"""
|
||||
This function will drop the FTS Dictionary object
|
||||
:param gid: group id
|
||||
@ -535,6 +535,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:param did: database id
|
||||
:param scid: schema id
|
||||
:param dcid: FTS Dictionary id
|
||||
:param only_sql: Return only sql if True
|
||||
"""
|
||||
if dcid is None:
|
||||
data = request.form if request.form else json.loads(
|
||||
@ -581,6 +582,10 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
cascade=cascade
|
||||
)
|
||||
|
||||
# Used for schema diff tool
|
||||
if only_sql:
|
||||
return sql
|
||||
|
||||
status, res = self.conn.execute_scalar(sql)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
@ -766,7 +771,8 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
|
||||
@check_precondition
|
||||
def sql(self, gid, sid, did, scid, dcid):
|
||||
def sql(self, gid, sid, did, scid, dcid, diff_schema=None,
|
||||
json_resp=True):
|
||||
"""
|
||||
This function will reverse generate sql for sql panel
|
||||
:param gid: group id
|
||||
@ -774,6 +780,8 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:param did: database id
|
||||
:param scid: schema id
|
||||
:param dcid: FTS Dictionary id
|
||||
:param diff_schema: Target Schema for schema diff
|
||||
:param json_resp: True then return json response
|
||||
"""
|
||||
|
||||
sql = render_template(
|
||||
@ -819,6 +827,9 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# Replace schema oid with schema name
|
||||
res['rows'][0]['schema'] = schema
|
||||
|
||||
if diff_schema:
|
||||
res['rows'][0]['schema'] = diff_schema
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'create.sql']),
|
||||
data=res['rows'][0],
|
||||
conn=self.conn, is_displaying=True)
|
||||
@ -832,6 +843,9 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
sql = sql_header + sql
|
||||
|
||||
if not json_resp:
|
||||
return sql
|
||||
|
||||
return ajax_response(response=sql.strip('\n'))
|
||||
|
||||
@check_precondition
|
||||
@ -897,5 +911,38 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
return res
|
||||
|
||||
def get_sql_from_diff(self, gid, sid, did, scid, oid, data=None,
|
||||
diff_schema=None, drop_sql=False):
|
||||
"""
|
||||
This function is used to get the DDL/DML statements.
|
||||
:param gid: Group ID
|
||||
:param sid: Serve ID
|
||||
:param did: Database ID
|
||||
:param scid: Schema ID
|
||||
:param oid: Collation ID
|
||||
:param data: Difference data
|
||||
:param diff_schema: Target Schema
|
||||
:param drop_sql: True if need to drop the fts configuration
|
||||
:return:
|
||||
"""
|
||||
sql = ''
|
||||
if data:
|
||||
if diff_schema:
|
||||
data['schema'] = diff_schema
|
||||
sql, name = self.get_sql(gid=gid, sid=sid, did=did, scid=scid,
|
||||
data=data, dcid=oid)
|
||||
else:
|
||||
if drop_sql:
|
||||
sql = self.delete(gid=gid, sid=sid, did=did,
|
||||
scid=scid, dcid=oid, only_sql=True)
|
||||
elif diff_schema:
|
||||
sql = self.sql(gid=gid, sid=sid, did=did, scid=scid, dcid=oid,
|
||||
diff_schema=diff_schema, json_resp=False)
|
||||
else:
|
||||
sql = self.sql(gid=gid, sid=sid, did=did, scid=scid, dcid=oid,
|
||||
json_resp=False)
|
||||
return sql
|
||||
|
||||
|
||||
SchemaDiffRegistry(blueprint.node_type, FtsDictionaryView)
|
||||
FtsDictionaryView.register_node_view(blueprint)
|
||||
|
@ -476,7 +476,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
|
||||
@check_precondition
|
||||
def delete(self, gid, sid, did, scid, pid=None):
|
||||
def delete(self, gid, sid, did, scid, pid=None, only_sql=False):
|
||||
"""
|
||||
This function will drop the fts_parser object
|
||||
:param gid: group id
|
||||
@ -484,6 +484,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:param did: database id
|
||||
:param scid: schema id
|
||||
:param pid: fts tempate id
|
||||
:param only_sql: Return only sql if True
|
||||
"""
|
||||
if pid is None:
|
||||
data = request.form if request.form else json.loads(
|
||||
@ -530,6 +531,10 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
cascade=cascade
|
||||
)
|
||||
|
||||
# Used for schema diff tool
|
||||
if only_sql:
|
||||
return sql
|
||||
|
||||
status, res = self.conn.execute_scalar(sql)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
@ -813,7 +818,8 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
|
||||
@check_precondition
|
||||
def sql(self, gid, sid, did, scid, pid):
|
||||
def sql(self, gid, sid, did, scid, pid, diff_schema=None,
|
||||
json_resp=True):
|
||||
"""
|
||||
This function will reverse generate sql for sql panel
|
||||
:param gid: group id
|
||||
@ -821,6 +827,8 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:param did: database id
|
||||
:param scid: schema id
|
||||
:param pid: fts tempate id
|
||||
:param diff_schema: Target Schema for schema diff
|
||||
:param json_resp: True then return json response
|
||||
"""
|
||||
try:
|
||||
sql = render_template(
|
||||
@ -846,6 +854,25 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
)
|
||||
|
||||
# Used for schema diff tool
|
||||
if diff_schema:
|
||||
data = {'schema': scid}
|
||||
# Fetch schema name from schema oid
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'schema.sql']),
|
||||
data=data,
|
||||
conn=self.conn,
|
||||
)
|
||||
|
||||
status, schema = self.conn.execute_scalar(sql)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=schema)
|
||||
|
||||
res = res.replace(schema, diff_schema)
|
||||
|
||||
if not json_resp:
|
||||
return res
|
||||
|
||||
return ajax_response(response=res)
|
||||
|
||||
except Exception as e:
|
||||
@ -915,5 +942,38 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
return res
|
||||
|
||||
def get_sql_from_diff(self, gid, sid, did, scid, oid, data=None,
|
||||
diff_schema=None, drop_sql=False):
|
||||
"""
|
||||
This function is used to get the DDL/DML statements.
|
||||
:param gid: Group ID
|
||||
:param sid: Serve ID
|
||||
:param did: Database ID
|
||||
:param scid: Schema ID
|
||||
:param oid: Collation ID
|
||||
:param data: Difference data
|
||||
:param diff_schema: Target Schema
|
||||
:param drop_sql: True if need to drop the fts configuration
|
||||
:return:
|
||||
"""
|
||||
sql = ''
|
||||
if data:
|
||||
if diff_schema:
|
||||
data['schema'] = diff_schema
|
||||
sql, name = self.get_sql(gid=gid, sid=sid, did=did, scid=scid,
|
||||
data=data, pid=oid)
|
||||
else:
|
||||
if drop_sql:
|
||||
sql = self.delete(gid=gid, sid=sid, did=did,
|
||||
scid=scid, pid=oid, only_sql=True)
|
||||
elif diff_schema:
|
||||
sql = self.sql(gid=gid, sid=sid, did=did, scid=scid, pid=oid,
|
||||
diff_schema=diff_schema, json_resp=False)
|
||||
else:
|
||||
sql = self.sql(gid=gid, sid=sid, did=did, scid=scid, pid=oid,
|
||||
json_resp=False)
|
||||
return sql
|
||||
|
||||
|
||||
SchemaDiffRegistry(blueprint.node_type, FtsParserView)
|
||||
FtsParserView.register_node_view(blueprint)
|
||||
|
@ -15,6 +15,23 @@ ALTER TEXT SEARCH PARSER {{conn|qtIdent(o_data.schema)}}.{{conn|qtIdent(o_data.n
|
||||
ALTER TEXT SEARCH PARSER {{conn|qtIdent(o_data.schema)}}.{{conn|qtIdent(name)}}
|
||||
SET SCHEMA {{data.schema}};
|
||||
{% endif %}
|
||||
{# Schema Diff SQL for FTS PARSER #}
|
||||
{% if data.prsstart or data.prstoken or data.prsend or data.prslextype or data.prsheadline %}
|
||||
-- WARNING:
|
||||
-- We have found the difference in either of START or GETTOKEN or END or
|
||||
-- LEXTYPES or HEADLINE, so we need to drop the existing parser first
|
||||
-- and re-create it.
|
||||
DROP TEXT SEARCH PARSER {{conn|qtIdent(o_data.schema)}}.{{conn|qtIdent(name)}};
|
||||
|
||||
CREATE TEXT SEARCH PARSER {{ conn|qtIdent(o_data.schema, name) }} (
|
||||
START = {% if data.prsstart is defined %}{{data.prsstart}}{% else %}{{o_data.prsstart}}{% endif %},
|
||||
GETTOKEN = {% if data.prstoken is defined %}{{data.prstoken}}{% else %}{{o_data.prstoken}}{% endif %},
|
||||
END = {% if data.prsend is defined %}{{data.prsend}}{% else %}{{o_data.prsend}}{% endif %},
|
||||
LEXTYPES = {% if data.prslextype is defined %}{{data.prslextype}}{% else %}{{o_data.prslextype}}{% endif %}{% if (data.prsheadline and data.prsheadline != '-') or (o_data.prsheadline and o_data.prsheadline != '-') %},
|
||||
HEADLINE = {% if data.prsheadline is defined %}{{data.prsheadline}}{% else %}{{o_data.prsheadline}}{% endif %}{% endif %}
|
||||
|
||||
);
|
||||
{% endif %}
|
||||
{% if "description" in data and data.description != o_data.description %}
|
||||
COMMENT ON TEXT SEARCH PARSER {{conn|qtIdent(o_data.schema)}}.{{conn|qtIdent(name)}}
|
||||
IS {{ data.description|qtLiteral }};
|
||||
|
@ -443,7 +443,7 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
|
||||
@check_precondition
|
||||
def delete(self, gid, sid, did, scid, tid=None):
|
||||
def delete(self, gid, sid, did, scid, tid=None, only_sql=False):
|
||||
"""
|
||||
This function will drop the fts_template object
|
||||
:param gid: group id
|
||||
@ -451,6 +451,7 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:param did: database id
|
||||
:param scid: schema id
|
||||
:param tid: fts tempate id
|
||||
:param only_sql: Return only sql if True
|
||||
"""
|
||||
if tid is None:
|
||||
data = request.form if request.form else json.loads(
|
||||
@ -493,6 +494,10 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
cascade=cascade
|
||||
)
|
||||
|
||||
# Used for schema diff tool
|
||||
if only_sql:
|
||||
return sql
|
||||
|
||||
status, res = self.conn.execute_scalar(sql)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
@ -691,7 +696,8 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
|
||||
@check_precondition
|
||||
def sql(self, gid, sid, did, scid, tid):
|
||||
def sql(self, gid, sid, did, scid, tid, diff_schema=None,
|
||||
json_resp=True):
|
||||
"""
|
||||
This function will reverse generate sql for sql panel
|
||||
:param gid: group id
|
||||
@ -699,6 +705,8 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:param did: database id
|
||||
:param scid: schema id
|
||||
:param tid: fts tempate id
|
||||
:param diff_schema: Target Schema for schema diff
|
||||
:param json_resp: True then return json response
|
||||
"""
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'sql.sql']),
|
||||
@ -721,6 +729,25 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"FTS Template node.")
|
||||
)
|
||||
|
||||
# Used for schema diff tool
|
||||
if diff_schema:
|
||||
data = {'schema': scid}
|
||||
# Fetch schema name from schema oid
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'schema.sql']),
|
||||
data=data,
|
||||
conn=self.conn,
|
||||
)
|
||||
|
||||
status, schema = self.conn.execute_scalar(sql)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=schema)
|
||||
|
||||
res = res.replace(schema, diff_schema)
|
||||
|
||||
if not json_resp:
|
||||
return res
|
||||
|
||||
return ajax_response(response=res)
|
||||
|
||||
@check_precondition
|
||||
@ -786,5 +813,38 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
return res
|
||||
|
||||
def get_sql_from_diff(self, gid, sid, did, scid, oid, data=None,
|
||||
diff_schema=None, drop_sql=False):
|
||||
"""
|
||||
This function is used to get the DDL/DML statements.
|
||||
:param gid: Group ID
|
||||
:param sid: Serve ID
|
||||
:param did: Database ID
|
||||
:param scid: Schema ID
|
||||
:param oid: Collation ID
|
||||
:param data: Difference data
|
||||
:param diff_schema: Target Schema
|
||||
:param drop_sql: True if need to drop the fts configuration
|
||||
:return:
|
||||
"""
|
||||
sql = ''
|
||||
if data:
|
||||
if diff_schema:
|
||||
data['schema'] = diff_schema
|
||||
sql, name = self.get_sql(gid=gid, sid=sid, did=did, scid=scid,
|
||||
data=data, tid=oid)
|
||||
else:
|
||||
if drop_sql:
|
||||
sql = self.delete(gid=gid, sid=sid, did=did,
|
||||
scid=scid, tid=oid, only_sql=True)
|
||||
elif diff_schema:
|
||||
sql = self.sql(gid=gid, sid=sid, did=did, scid=scid, tid=oid,
|
||||
diff_schema=diff_schema, json_resp=False)
|
||||
else:
|
||||
sql = self.sql(gid=gid, sid=sid, did=did, scid=scid, tid=oid,
|
||||
json_resp=False)
|
||||
return sql
|
||||
|
||||
|
||||
SchemaDiffRegistry(blueprint.node_type, FtsTemplateView)
|
||||
FtsTemplateView.register_node_view(blueprint)
|
||||
|
@ -15,6 +15,21 @@ ALTER TEXT SEARCH TEMPLATE {{conn|qtIdent(o_data.schema)}}.{{conn|qtIdent(o_data
|
||||
ALTER TEXT SEARCH TEMPLATE {{conn|qtIdent(o_data.schema)}}.{{conn|qtIdent(name)}}
|
||||
SET SCHEMA {{conn|qtIdent(data.schema)}};
|
||||
{% endif %}
|
||||
{# Schema Diff SQL for FTS PARSER #}
|
||||
{% if data.tmplinit or data.tmpllexize %}
|
||||
-- WARNING:
|
||||
-- We have found the difference in either of INIT or LEXIZE,
|
||||
-- so we need to drop the existing template first and re-create it.
|
||||
DROP TEXT SEARCH TEMPLATE {{conn|qtIdent(o_data.schema)}}.{{conn|qtIdent(name)}};
|
||||
|
||||
CREATE TEXT SEARCH TEMPLATE {{ conn|qtIdent(o_data.schema, name) }} (
|
||||
{% if data.tmplinit and data.tmplinit != '-'%}
|
||||
INIT = {{data.tmplinit}},
|
||||
{% endif %}
|
||||
LEXIZE = {% if data.tmpllexize is defined %}{{data.tmpllexize}}{% else %}{{o_data.tmpllexize}}{% endif %}
|
||||
|
||||
);
|
||||
{% endif %}
|
||||
{% if 'description' in data and data.description != o_data.description %}
|
||||
COMMENT ON TEXT SEARCH TEMPLATE {{conn|qtIdent(o_data.schema)}}.{{conn|qtIdent(name)}}
|
||||
IS {{ data.description|qtLiteral }};
|
||||
|
@ -1366,7 +1366,10 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
|
||||
# Check if partition is again declare as partitioned table.
|
||||
if 'is_sub_partitioned' in row and row['is_sub_partitioned']:
|
||||
part_data['partition_scheme'] = self.get_partition_scheme(row)
|
||||
part_data['partition_scheme'] = row['sub_partition_scheme'] \
|
||||
if 'sub_partition_scheme' in row else \
|
||||
self.get_partition_scheme(row)
|
||||
|
||||
part_data['is_partitioned'] = True
|
||||
|
||||
if 'is_attach' in row and row['is_attach']:
|
||||
|
@ -435,7 +435,7 @@ def compare(trans_id, source_sid, source_did, source_scid,
|
||||
status, msg = check_version_compatibility(source_sid, target_sid)
|
||||
|
||||
if not status:
|
||||
return make_json_response(success=0, errormsg=msg, status=404)
|
||||
return make_json_response(success=0, errormsg=msg, status=428)
|
||||
|
||||
comparison_result = []
|
||||
|
||||
|
@ -318,37 +318,40 @@ def directory_diff(source_dict, target_dict, ignore_keys=[], difference={}):
|
||||
))
|
||||
|
||||
if len(tmp_list) > 0:
|
||||
tmp_target = copy.deepcopy(target_dict[key])
|
||||
for index in range(len(source_dict[key])):
|
||||
source = copy.deepcopy(source_dict[key][index])
|
||||
if type(source) is list:
|
||||
# TODO
|
||||
pass
|
||||
elif type(source) is dict:
|
||||
tmp_key_array = ['name', 'colname', 'argid']
|
||||
for tmp_key in tmp_key_array:
|
||||
if tmp_key in source:
|
||||
if type(target_dict[key]) is list and \
|
||||
len(target_dict[key]) > 0:
|
||||
tmp = None
|
||||
tmp_target = \
|
||||
copy.deepcopy(target_dict[key])
|
||||
for item in tmp_target:
|
||||
if tmp_key in item and \
|
||||
item[tmp_key] == \
|
||||
source[tmp_key]:
|
||||
tmp = copy.deepcopy(item)
|
||||
if tmp and source != tmp:
|
||||
updated.append(copy.deepcopy(source))
|
||||
tmp_target.remove(tmp)
|
||||
elif tmp and source == tmp:
|
||||
tmp_target.remove(tmp)
|
||||
elif tmp is None:
|
||||
added.append(source)
|
||||
else:
|
||||
tmp_key_array = ['name', 'colname', 'argid', 'token',
|
||||
'option']
|
||||
# Check the above keys are exist in the dictionary
|
||||
tmp_key = is_key_exists(tmp_key_array, source)
|
||||
if tmp_key is not None:
|
||||
if type(target_dict[key]) is list and \
|
||||
len(target_dict[key]) > 0:
|
||||
tmp = None
|
||||
for item in tmp_target:
|
||||
if tmp_key in item and \
|
||||
item[tmp_key] == \
|
||||
source[tmp_key]:
|
||||
tmp = copy.deepcopy(item)
|
||||
if tmp and source != tmp:
|
||||
updated.append(copy.deepcopy(source))
|
||||
tmp_target.remove(tmp)
|
||||
elif tmp and source == tmp:
|
||||
tmp_target.remove(tmp)
|
||||
elif tmp is None:
|
||||
added.append(source)
|
||||
else:
|
||||
added.append(source)
|
||||
|
||||
difference[key] = {}
|
||||
difference[key] = {}
|
||||
if len(added) > 0:
|
||||
difference[key]['added'] = added
|
||||
if len(updated) > 0:
|
||||
difference[key]['changed'] = updated
|
||||
elif target_dict[key] is None or \
|
||||
(type(target_dict[key]) is list and
|
||||
@ -358,7 +361,7 @@ def directory_diff(source_dict, target_dict, ignore_keys=[], difference={}):
|
||||
elif type(target_dict[key]) is list and\
|
||||
len(target_dict[key]) > index:
|
||||
difference[key] = source
|
||||
else:
|
||||
elif len(source_dict[key]) > 0:
|
||||
difference[key] = source_dict[key]
|
||||
|
||||
if type(source) is dict and tmp_target and key in tmp_target and \
|
||||
@ -383,6 +386,21 @@ def directory_diff(source_dict, target_dict, ignore_keys=[], difference={}):
|
||||
return difference
|
||||
|
||||
|
||||
def is_key_exists(key_list, target_dict):
|
||||
"""
|
||||
This function is used to iterate the key list and check that key is
|
||||
present in the given dictionary
|
||||
:param key_list:
|
||||
:param target_dict:
|
||||
:return:
|
||||
"""
|
||||
for key in key_list:
|
||||
if key in target_dict:
|
||||
return key
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def parce_acl(source, target):
|
||||
key = 'acl'
|
||||
|
||||
|
@ -438,3 +438,91 @@ ALTER TABLE source."test view f" OWNER TO postgres;
|
||||
--
|
||||
|
||||
COMMENT ON VIEW source."test view f" IS 'cmn';
|
||||
|
||||
-- Collation scripts
|
||||
CREATE COLLATION source.coll_src
|
||||
FROM pg_catalog."POSIX";
|
||||
|
||||
ALTER COLLATION source.coll_src
|
||||
OWNER TO postgres;
|
||||
|
||||
COMMENT ON COLLATION source.coll_src
|
||||
IS 'Test Comment';
|
||||
|
||||
CREATE COLLATION source.coll_diff
|
||||
(LC_COLLATE = 'POSIX', LC_CTYPE = 'POSIX');
|
||||
|
||||
ALTER COLLATION source.coll_diff
|
||||
OWNER TO postgres;
|
||||
|
||||
COMMENT ON COLLATION source.coll_diff
|
||||
IS 'Test Comment';
|
||||
|
||||
-- FTS Configuration scripts
|
||||
CREATE TEXT SEARCH CONFIGURATION source.fts_con_src (
|
||||
COPY=german
|
||||
);
|
||||
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_src OWNER TO postgres;
|
||||
|
||||
COMMENT ON TEXT SEARCH CONFIGURATION source.fts_con_src
|
||||
IS 'Test Comment';
|
||||
|
||||
|
||||
CREATE TEXT SEARCH CONFIGURATION source.fts_con_diff (
|
||||
PARSER = default
|
||||
);
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_diff ADD MAPPING FOR asciiword WITH german_stem;
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_diff ADD MAPPING FOR email WITH simple;
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_diff ADD MAPPING FOR hword WITH dutch_stem;
|
||||
|
||||
-- FTS Dictionary scripts
|
||||
CREATE TEXT SEARCH DICTIONARY source.fts_dict_src (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'english'
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH DICTIONARY source.fts_dict_src
|
||||
IS 'Test Comment';
|
||||
|
||||
CREATE TEXT SEARCH DICTIONARY source.fts_dict_diff (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'english'
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH DICTIONARY source.fts_dict_diff
|
||||
IS 'Test Comment';
|
||||
|
||||
-- FTS Parser scripts
|
||||
CREATE TEXT SEARCH PARSER source.fts_par_src (
|
||||
START = prsd_start,
|
||||
GETTOKEN = prsd_nexttoken,
|
||||
END = prsd_end,
|
||||
LEXTYPES = prsd_lextype);
|
||||
|
||||
COMMENT ON TEXT SEARCH PARSER source.fts_par_src
|
||||
IS 'Test Comment';
|
||||
|
||||
CREATE TEXT SEARCH PARSER source.fts_par_diff (
|
||||
START = prsd_start,
|
||||
GETTOKEN = prsd_nexttoken,
|
||||
END = prsd_end,
|
||||
LEXTYPES = prsd_lextype);
|
||||
|
||||
COMMENT ON TEXT SEARCH PARSER source.fts_par_diff
|
||||
IS 'Test Comment';
|
||||
|
||||
-- FTS Template scripts
|
||||
CREATE TEXT SEARCH TEMPLATE source.fts_templ_src (
|
||||
INIT = dispell_init,
|
||||
LEXIZE = dispell_lexize
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH TEMPLATE source.fts_templ_src IS 'Test Comment';
|
||||
|
||||
CREATE TEXT SEARCH TEMPLATE source.fts_templ_diff (
|
||||
INIT = dispell_init,
|
||||
LEXIZE = dispell_lexize
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH TEMPLATE source.fts_templ_diff IS 'Test Comment';
|
||||
|
@ -427,3 +427,73 @@ ALTER TABLE target."test view f" OWNER TO postgres;
|
||||
--
|
||||
|
||||
COMMENT ON VIEW target."test view f" IS 'cmn';
|
||||
|
||||
-- Collation scripts
|
||||
CREATE COLLATION target.coll_tar
|
||||
FROM pg_catalog."POSIX";
|
||||
|
||||
ALTER COLLATION target.coll_tar
|
||||
OWNER TO postgres;
|
||||
|
||||
CREATE COLLATION target.coll_diff
|
||||
(LC_COLLATE = 'C', LC_CTYPE = 'C');
|
||||
|
||||
ALTER COLLATION target.coll_diff
|
||||
OWNER TO postgres;
|
||||
|
||||
-- FTS Configuration scripts
|
||||
CREATE TEXT SEARCH CONFIGURATION target.fts_con_tar (
|
||||
COPY=german
|
||||
);
|
||||
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_tar OWNER TO postgres;
|
||||
|
||||
CREATE TEXT SEARCH CONFIGURATION target.fts_con_diff (
|
||||
PARSER = default
|
||||
);
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_diff ADD MAPPING FOR asciiword WITH dutch_stem;
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_diff ADD MAPPING FOR email WITH simple;
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_diff ADD MAPPING FOR hword WITH german_stem;
|
||||
|
||||
-- FTS Dictionary scripts
|
||||
CREATE TEXT SEARCH DICTIONARY target.fts_dict_tar (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'english'
|
||||
);
|
||||
|
||||
CREATE TEXT SEARCH DICTIONARY target.fts_dict_diff (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'german'
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH DICTIONARY target.fts_dict_diff
|
||||
IS 'Comment';
|
||||
|
||||
-- FTS Parser scripts
|
||||
CREATE TEXT SEARCH PARSER target.fts_par_tar (
|
||||
START = prsd_start,
|
||||
GETTOKEN = prsd_nexttoken,
|
||||
END = prsd_end,
|
||||
LEXTYPES = prsd_lextype);
|
||||
|
||||
CREATE TEXT SEARCH PARSER target.fts_par_diff (
|
||||
START = int4_accum,
|
||||
GETTOKEN = inet_gist_penalty,
|
||||
END = btint2sortsupport,
|
||||
LEXTYPES = dispell_init);
|
||||
|
||||
COMMENT ON TEXT SEARCH PARSER target.fts_par_diff
|
||||
IS 'Comment';
|
||||
|
||||
-- FTS Template scripts
|
||||
CREATE TEXT SEARCH TEMPLATE target.fts_templ_tar (
|
||||
INIT = dispell_init,
|
||||
LEXIZE = dispell_lexize
|
||||
);
|
||||
|
||||
CREATE TEXT SEARCH TEMPLATE target.fts_templ_diff (
|
||||
INIT = dsimple_init,
|
||||
LEXIZE = dsimple_lexize
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH TEMPLATE target.fts_templ_diff IS 'Comment';
|
||||
|
@ -437,3 +437,91 @@ ALTER TABLE source."test view f" OWNER TO postgres;
|
||||
--
|
||||
|
||||
COMMENT ON VIEW source."test view f" IS 'cmn';
|
||||
|
||||
-- Collation scripts
|
||||
CREATE COLLATION source.coll_src
|
||||
FROM pg_catalog."POSIX";
|
||||
|
||||
ALTER COLLATION source.coll_src
|
||||
OWNER TO postgres;
|
||||
|
||||
COMMENT ON COLLATION source.coll_src
|
||||
IS 'Test Comment';
|
||||
|
||||
CREATE COLLATION source.coll_diff
|
||||
(LC_COLLATE = 'POSIX', LC_CTYPE = 'POSIX');
|
||||
|
||||
ALTER COLLATION source.coll_diff
|
||||
OWNER TO postgres;
|
||||
|
||||
COMMENT ON COLLATION source.coll_diff
|
||||
IS 'Test Comment';
|
||||
|
||||
-- FTS Configuration scripts
|
||||
CREATE TEXT SEARCH CONFIGURATION source.fts_con_src (
|
||||
COPY=german
|
||||
);
|
||||
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_src OWNER TO postgres;
|
||||
|
||||
COMMENT ON TEXT SEARCH CONFIGURATION source.fts_con_src
|
||||
IS 'Test Comment';
|
||||
|
||||
|
||||
CREATE TEXT SEARCH CONFIGURATION source.fts_con_diff (
|
||||
PARSER = default
|
||||
);
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_diff ADD MAPPING FOR asciiword WITH german_stem;
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_diff ADD MAPPING FOR email WITH simple;
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_diff ADD MAPPING FOR hword WITH dutch_stem;
|
||||
|
||||
-- FTS Dictionary scripts
|
||||
CREATE TEXT SEARCH DICTIONARY source.fts_dict_src (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'english'
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH DICTIONARY source.fts_dict_src
|
||||
IS 'Test Comment';
|
||||
|
||||
CREATE TEXT SEARCH DICTIONARY source.fts_dict_diff (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'english'
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH DICTIONARY source.fts_dict_diff
|
||||
IS 'Test Comment';
|
||||
|
||||
-- FTS Parser scripts
|
||||
CREATE TEXT SEARCH PARSER source.fts_par_src (
|
||||
START = prsd_start,
|
||||
GETTOKEN = prsd_nexttoken,
|
||||
END = prsd_end,
|
||||
LEXTYPES = prsd_lextype);
|
||||
|
||||
COMMENT ON TEXT SEARCH PARSER source.fts_par_src
|
||||
IS 'Test Comment';
|
||||
|
||||
CREATE TEXT SEARCH PARSER source.fts_par_diff (
|
||||
START = prsd_start,
|
||||
GETTOKEN = prsd_nexttoken,
|
||||
END = prsd_end,
|
||||
LEXTYPES = prsd_lextype);
|
||||
|
||||
COMMENT ON TEXT SEARCH PARSER source.fts_par_diff
|
||||
IS 'Test Comment';
|
||||
|
||||
-- FTS Template scripts
|
||||
CREATE TEXT SEARCH TEMPLATE source.fts_templ_src (
|
||||
INIT = dispell_init,
|
||||
LEXIZE = dispell_lexize
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH TEMPLATE source.fts_templ_src IS 'Test Comment';
|
||||
|
||||
CREATE TEXT SEARCH TEMPLATE source.fts_templ_diff (
|
||||
INIT = dispell_init,
|
||||
LEXIZE = dispell_lexize
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH TEMPLATE source.fts_templ_diff IS 'Test Comment';
|
||||
|
@ -426,3 +426,73 @@ ALTER TABLE target."test view f" OWNER TO postgres;
|
||||
--
|
||||
|
||||
COMMENT ON VIEW target."test view f" IS 'cmn';
|
||||
|
||||
-- Collation scripts
|
||||
CREATE COLLATION target.coll_tar
|
||||
FROM pg_catalog."POSIX";
|
||||
|
||||
ALTER COLLATION target.coll_tar
|
||||
OWNER TO postgres;
|
||||
|
||||
CREATE COLLATION target.coll_diff
|
||||
(LC_COLLATE = 'C', LC_CTYPE = 'C');
|
||||
|
||||
ALTER COLLATION target.coll_diff
|
||||
OWNER TO postgres;
|
||||
|
||||
-- FTS Configuration scripts
|
||||
CREATE TEXT SEARCH CONFIGURATION target.fts_con_tar (
|
||||
COPY=german
|
||||
);
|
||||
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_tar OWNER TO postgres;
|
||||
|
||||
CREATE TEXT SEARCH CONFIGURATION target.fts_con_diff (
|
||||
PARSER = default
|
||||
);
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_diff ADD MAPPING FOR asciiword WITH dutch_stem;
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_diff ADD MAPPING FOR email WITH simple;
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_diff ADD MAPPING FOR hword WITH german_stem;
|
||||
|
||||
-- FTS Dictionary scripts
|
||||
CREATE TEXT SEARCH DICTIONARY target.fts_dict_tar (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'english'
|
||||
);
|
||||
|
||||
CREATE TEXT SEARCH DICTIONARY target.fts_dict_diff (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'german'
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH DICTIONARY target.fts_dict_diff
|
||||
IS 'Comment';
|
||||
|
||||
-- FTS Parser scripts
|
||||
CREATE TEXT SEARCH PARSER target.fts_par_tar (
|
||||
START = prsd_start,
|
||||
GETTOKEN = prsd_nexttoken,
|
||||
END = prsd_end,
|
||||
LEXTYPES = prsd_lextype);
|
||||
|
||||
CREATE TEXT SEARCH PARSER target.fts_par_diff (
|
||||
START = int4_accum,
|
||||
GETTOKEN = inet_gist_penalty,
|
||||
END = btint2sortsupport,
|
||||
LEXTYPES = dispell_init);
|
||||
|
||||
COMMENT ON TEXT SEARCH PARSER target.fts_par_diff
|
||||
IS 'Comment';
|
||||
|
||||
-- FTS Template scripts
|
||||
CREATE TEXT SEARCH TEMPLATE target.fts_templ_tar (
|
||||
INIT = dispell_init,
|
||||
LEXIZE = dispell_lexize
|
||||
);
|
||||
|
||||
CREATE TEXT SEARCH TEMPLATE target.fts_templ_diff (
|
||||
INIT = dsimple_init,
|
||||
LEXIZE = dsimple_lexize
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH TEMPLATE target.fts_templ_diff IS 'Comment';
|
||||
|
@ -438,3 +438,91 @@ CREATE PROCEDURE source.proc1(arg1 bigint)
|
||||
|
||||
|
||||
ALTER PROCEDURE source.proc1(arg1 bigint) OWNER TO postgres;
|
||||
|
||||
-- Collation scripts
|
||||
CREATE COLLATION source.coll_src
|
||||
FROM pg_catalog."POSIX";
|
||||
|
||||
ALTER COLLATION source.coll_src
|
||||
OWNER TO postgres;
|
||||
|
||||
COMMENT ON COLLATION source.coll_src
|
||||
IS 'Test Comment';
|
||||
|
||||
CREATE COLLATION source.coll_diff
|
||||
(LC_COLLATE = 'POSIX', LC_CTYPE = 'POSIX');
|
||||
|
||||
ALTER COLLATION source.coll_diff
|
||||
OWNER TO postgres;
|
||||
|
||||
COMMENT ON COLLATION source.coll_diff
|
||||
IS 'Test Comment';
|
||||
|
||||
-- FTS Configuration scripts
|
||||
CREATE TEXT SEARCH CONFIGURATION source.fts_con_src (
|
||||
COPY=german
|
||||
);
|
||||
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_src OWNER TO postgres;
|
||||
|
||||
COMMENT ON TEXT SEARCH CONFIGURATION source.fts_con_src
|
||||
IS 'Test Comment';
|
||||
|
||||
|
||||
CREATE TEXT SEARCH CONFIGURATION source.fts_con_diff (
|
||||
PARSER = default
|
||||
);
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_diff ADD MAPPING FOR asciiword WITH german_stem;
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_diff ADD MAPPING FOR email WITH simple;
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_diff ADD MAPPING FOR hword WITH dutch_stem;
|
||||
|
||||
-- FTS Dictionary scripts
|
||||
CREATE TEXT SEARCH DICTIONARY source.fts_dict_src (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'english'
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH DICTIONARY source.fts_dict_src
|
||||
IS 'Test Comment';
|
||||
|
||||
CREATE TEXT SEARCH DICTIONARY source.fts_dict_diff (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'english'
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH DICTIONARY source.fts_dict_diff
|
||||
IS 'Test Comment';
|
||||
|
||||
-- FTS Parser scripts
|
||||
CREATE TEXT SEARCH PARSER source.fts_par_src (
|
||||
START = prsd_start,
|
||||
GETTOKEN = prsd_nexttoken,
|
||||
END = prsd_end,
|
||||
LEXTYPES = prsd_lextype);
|
||||
|
||||
COMMENT ON TEXT SEARCH PARSER source.fts_par_src
|
||||
IS 'Test Comment';
|
||||
|
||||
CREATE TEXT SEARCH PARSER source.fts_par_diff (
|
||||
START = prsd_start,
|
||||
GETTOKEN = prsd_nexttoken,
|
||||
END = prsd_end,
|
||||
LEXTYPES = prsd_lextype);
|
||||
|
||||
COMMENT ON TEXT SEARCH PARSER source.fts_par_diff
|
||||
IS 'Test Comment';
|
||||
|
||||
-- FTS Template scripts
|
||||
CREATE TEXT SEARCH TEMPLATE source.fts_templ_src (
|
||||
INIT = dispell_init,
|
||||
LEXIZE = dispell_lexize
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH TEMPLATE source.fts_templ_src IS 'Test Comment';
|
||||
|
||||
CREATE TEXT SEARCH TEMPLATE source.fts_templ_diff (
|
||||
INIT = dispell_init,
|
||||
LEXIZE = dispell_lexize
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH TEMPLATE source.fts_templ_diff IS 'Test Comment';
|
||||
|
@ -415,3 +415,73 @@ CREATE PROCEDURE target.dodaj_klijenta(v_naziv character varying, v_oib characte
|
||||
|
||||
|
||||
ALTER PROCEDURE target.dodaj_klijenta(v_naziv character varying, v_oib character varying, v_pdv_id character varying, v_adresa character varying, v_mjesto integer, v_drzava character varying, v_tip_p_sub character varying, v_vlasnik character varying, v_pdv boolean, v_fisk boolean, v_iban character varying, v_k_osoba character varying, v_email character varying, v_br_tel character varying, v_radna_god numeric, v_schema character varying) OWNER TO postgres;
|
||||
|
||||
-- Collation scripts
|
||||
CREATE COLLATION target.coll_tar
|
||||
FROM pg_catalog."POSIX";
|
||||
|
||||
ALTER COLLATION target.coll_tar
|
||||
OWNER TO postgres;
|
||||
|
||||
CREATE COLLATION target.coll_diff
|
||||
(LC_COLLATE = 'C', LC_CTYPE = 'C');
|
||||
|
||||
ALTER COLLATION target.coll_diff
|
||||
OWNER TO postgres;
|
||||
|
||||
-- FTS Configuration scripts
|
||||
CREATE TEXT SEARCH CONFIGURATION target.fts_con_tar (
|
||||
COPY=german
|
||||
);
|
||||
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_tar OWNER TO postgres;
|
||||
|
||||
CREATE TEXT SEARCH CONFIGURATION target.fts_con_diff (
|
||||
PARSER = default
|
||||
);
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_diff ADD MAPPING FOR asciiword WITH dutch_stem;
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_diff ADD MAPPING FOR email WITH simple;
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_diff ADD MAPPING FOR hword WITH german_stem;
|
||||
|
||||
-- FTS Dictionary scripts
|
||||
CREATE TEXT SEARCH DICTIONARY target.fts_dict_tar (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'english'
|
||||
);
|
||||
|
||||
CREATE TEXT SEARCH DICTIONARY target.fts_dict_diff (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'german'
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH DICTIONARY target.fts_dict_diff
|
||||
IS 'Comment';
|
||||
|
||||
-- FTS Parser scripts
|
||||
CREATE TEXT SEARCH PARSER target.fts_par_tar (
|
||||
START = prsd_start,
|
||||
GETTOKEN = prsd_nexttoken,
|
||||
END = prsd_end,
|
||||
LEXTYPES = prsd_lextype);
|
||||
|
||||
CREATE TEXT SEARCH PARSER target.fts_par_diff (
|
||||
START = int4_accum,
|
||||
GETTOKEN = inet_gist_penalty,
|
||||
END = btint2sortsupport,
|
||||
LEXTYPES = dispell_init);
|
||||
|
||||
COMMENT ON TEXT SEARCH PARSER target.fts_par_diff
|
||||
IS 'Comment';
|
||||
|
||||
-- FTS Template scripts
|
||||
CREATE TEXT SEARCH TEMPLATE target.fts_templ_tar (
|
||||
INIT = dispell_init,
|
||||
LEXIZE = dispell_lexize
|
||||
);
|
||||
|
||||
CREATE TEXT SEARCH TEMPLATE target.fts_templ_diff (
|
||||
INIT = dsimple_init,
|
||||
LEXIZE = dsimple_lexize
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH TEMPLATE target.fts_templ_diff IS 'Comment';
|
||||
|
@ -309,3 +309,89 @@ COMMENT ON RULE rule1 ON source.table_for_rule IS 'comments';
|
||||
CREATE RULE rule2 AS
|
||||
ON INSERT TO source.table_for_rule DO NOTHING;
|
||||
|
||||
-- Collation scripts
|
||||
CREATE COLLATION source.coll_src
|
||||
FROM pg_catalog."POSIX";
|
||||
|
||||
ALTER COLLATION source.coll_src
|
||||
OWNER TO postgres;
|
||||
|
||||
COMMENT ON COLLATION source.coll_src
|
||||
IS 'Test Comment';
|
||||
|
||||
CREATE COLLATION source.coll_diff
|
||||
(LC_COLLATE = 'POSIX', LC_CTYPE = 'POSIX');
|
||||
|
||||
ALTER COLLATION source.coll_diff
|
||||
OWNER TO postgres;
|
||||
|
||||
COMMENT ON COLLATION source.coll_diff
|
||||
IS 'Test Comment';
|
||||
|
||||
-- FTS Configuration scripts
|
||||
CREATE TEXT SEARCH CONFIGURATION source.fts_con_src (
|
||||
COPY=german
|
||||
);
|
||||
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_src OWNER TO postgres;
|
||||
|
||||
COMMENT ON TEXT SEARCH CONFIGURATION source.fts_con_src
|
||||
IS 'Test Comment';
|
||||
|
||||
CREATE TEXT SEARCH CONFIGURATION source.fts_con_diff (
|
||||
PARSER = default
|
||||
);
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_diff ADD MAPPING FOR asciiword WITH german_stem;
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_diff ADD MAPPING FOR email WITH simple;
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_diff ADD MAPPING FOR hword WITH dutch_stem;
|
||||
|
||||
-- FTS Dictionary scripts
|
||||
CREATE TEXT SEARCH DICTIONARY source.fts_dict_src (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'english'
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH DICTIONARY source.fts_dict_src
|
||||
IS 'Test Comment';
|
||||
|
||||
CREATE TEXT SEARCH DICTIONARY source.fts_dict_diff (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'english'
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH DICTIONARY source.fts_dict_diff
|
||||
IS 'Test Comment';
|
||||
|
||||
-- FTS Parser scripts
|
||||
CREATE TEXT SEARCH PARSER source.fts_par_src (
|
||||
START = prsd_start,
|
||||
GETTOKEN = prsd_nexttoken,
|
||||
END = prsd_end,
|
||||
LEXTYPES = prsd_lextype);
|
||||
|
||||
COMMENT ON TEXT SEARCH PARSER source.fts_par_src
|
||||
IS 'Test Comment';
|
||||
|
||||
CREATE TEXT SEARCH PARSER source.fts_par_diff (
|
||||
START = prsd_start,
|
||||
GETTOKEN = prsd_nexttoken,
|
||||
END = prsd_end,
|
||||
LEXTYPES = prsd_lextype);
|
||||
|
||||
COMMENT ON TEXT SEARCH PARSER source.fts_par_diff
|
||||
IS 'Test Comment';
|
||||
|
||||
-- FTS Template scripts
|
||||
CREATE TEXT SEARCH TEMPLATE source.fts_templ_src (
|
||||
INIT = dispell_init,
|
||||
LEXIZE = dispell_lexize
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH TEMPLATE source.fts_templ_src IS 'Test Comment';
|
||||
|
||||
CREATE TEXT SEARCH TEMPLATE source.fts_templ_diff (
|
||||
INIT = dispell_init,
|
||||
LEXIZE = dispell_lexize
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH TEMPLATE source.fts_templ_diff IS 'Test Comment';
|
||||
|
@ -335,3 +335,73 @@ CREATE RULE rule3 AS
|
||||
--
|
||||
|
||||
REFRESH MATERIALIZED VIEW target."MView";
|
||||
|
||||
-- Collation scripts
|
||||
CREATE COLLATION target.coll_tar
|
||||
FROM pg_catalog."POSIX";
|
||||
|
||||
ALTER COLLATION target.coll_tar
|
||||
OWNER TO postgres;
|
||||
|
||||
CREATE COLLATION target.coll_diff
|
||||
(LC_COLLATE = 'C', LC_CTYPE = 'C');
|
||||
|
||||
ALTER COLLATION target.coll_diff
|
||||
OWNER TO postgres;
|
||||
|
||||
-- FTS Configuration scripts
|
||||
CREATE TEXT SEARCH CONFIGURATION target.fts_con_tar (
|
||||
COPY=german
|
||||
);
|
||||
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_tar OWNER TO postgres;
|
||||
|
||||
CREATE TEXT SEARCH CONFIGURATION target.fts_con_diff (
|
||||
PARSER = default
|
||||
);
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_diff ADD MAPPING FOR asciiword WITH dutch_stem;
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_diff ADD MAPPING FOR email WITH simple;
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_diff ADD MAPPING FOR hword WITH german_stem;
|
||||
|
||||
-- FTS Dictionary scripts
|
||||
CREATE TEXT SEARCH DICTIONARY target.fts_dict_tar (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'english'
|
||||
);
|
||||
|
||||
CREATE TEXT SEARCH DICTIONARY target.fts_dict_diff (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'german'
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH DICTIONARY target.fts_dict_diff
|
||||
IS 'Comment';
|
||||
|
||||
-- FTS Parser scripts
|
||||
CREATE TEXT SEARCH PARSER target.fts_par_tar (
|
||||
START = prsd_start,
|
||||
GETTOKEN = prsd_nexttoken,
|
||||
END = prsd_end,
|
||||
LEXTYPES = prsd_lextype);
|
||||
|
||||
CREATE TEXT SEARCH PARSER target.fts_par_diff (
|
||||
START = int4_accum,
|
||||
GETTOKEN = inet_gist_penalty,
|
||||
END = btint2sortsupport,
|
||||
LEXTYPES = dispell_init);
|
||||
|
||||
COMMENT ON TEXT SEARCH PARSER target.fts_par_diff
|
||||
IS 'Comment';
|
||||
|
||||
-- FTS Template scripts
|
||||
CREATE TEXT SEARCH TEMPLATE target.fts_templ_tar (
|
||||
INIT = dispell_init,
|
||||
LEXIZE = dispell_lexize
|
||||
);
|
||||
|
||||
CREATE TEXT SEARCH TEMPLATE target.fts_templ_diff (
|
||||
INIT = dsimple_init,
|
||||
LEXIZE = dsimple_lexize
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH TEMPLATE target.fts_templ_diff IS 'Comment';
|
||||
|
@ -374,3 +374,91 @@ COMMENT ON RULE rule1 ON source.table_for_rule IS 'comments';
|
||||
|
||||
CREATE RULE rule2 AS
|
||||
ON INSERT TO source.table_for_rule DO NOTHING;
|
||||
|
||||
-- Collation scripts
|
||||
CREATE COLLATION source.coll_src
|
||||
FROM pg_catalog."POSIX";
|
||||
|
||||
ALTER COLLATION source.coll_src
|
||||
OWNER TO enterprisedb;
|
||||
|
||||
COMMENT ON COLLATION source.coll_src
|
||||
IS 'Test Comment';
|
||||
|
||||
CREATE COLLATION source.coll_diff
|
||||
(LC_COLLATE = 'POSIX', LC_CTYPE = 'POSIX');
|
||||
|
||||
ALTER COLLATION source.coll_diff
|
||||
OWNER TO enterprisedb;
|
||||
|
||||
COMMENT ON COLLATION source.coll_diff
|
||||
IS 'Test Comment';
|
||||
|
||||
-- FTS Configuration scripts
|
||||
CREATE TEXT SEARCH CONFIGURATION source.fts_con_src (
|
||||
COPY=german
|
||||
);
|
||||
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_src OWNER TO enterprisedb;
|
||||
|
||||
COMMENT ON TEXT SEARCH CONFIGURATION source.fts_con_src
|
||||
IS 'Test Comment';
|
||||
|
||||
|
||||
CREATE TEXT SEARCH CONFIGURATION source.fts_con_diff (
|
||||
PARSER = default
|
||||
);
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_diff ADD MAPPING FOR asciiword WITH german_stem;
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_diff ADD MAPPING FOR email WITH simple;
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_diff ADD MAPPING FOR hword WITH dutch_stem;
|
||||
|
||||
-- FTS Dictionary scripts
|
||||
CREATE TEXT SEARCH DICTIONARY source.fts_dict_src (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'english'
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH DICTIONARY source.fts_dict_src
|
||||
IS 'Test Comment';
|
||||
|
||||
CREATE TEXT SEARCH DICTIONARY source.fts_dict_diff (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'english'
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH DICTIONARY source.fts_dict_diff
|
||||
IS 'Test Comment';
|
||||
|
||||
-- FTS Parser scripts
|
||||
CREATE TEXT SEARCH PARSER source.fts_par_src (
|
||||
START = prsd_start,
|
||||
GETTOKEN = prsd_nexttoken,
|
||||
END = prsd_end,
|
||||
LEXTYPES = prsd_lextype);
|
||||
|
||||
COMMENT ON TEXT SEARCH PARSER source.fts_par_src
|
||||
IS 'Test Comment';
|
||||
|
||||
CREATE TEXT SEARCH PARSER source.fts_par_diff (
|
||||
START = prsd_start,
|
||||
GETTOKEN = prsd_nexttoken,
|
||||
END = prsd_end,
|
||||
LEXTYPES = prsd_lextype);
|
||||
|
||||
COMMENT ON TEXT SEARCH PARSER source.fts_par_diff
|
||||
IS 'Test Comment';
|
||||
|
||||
-- FTS Template scripts
|
||||
CREATE TEXT SEARCH TEMPLATE source.fts_templ_src (
|
||||
INIT = dispell_init,
|
||||
LEXIZE = dispell_lexize
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH TEMPLATE source.fts_templ_src IS 'Test Comment';
|
||||
|
||||
CREATE TEXT SEARCH TEMPLATE source.fts_templ_diff (
|
||||
INIT = dispell_init,
|
||||
LEXIZE = dispell_lexize
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH TEMPLATE source.fts_templ_diff IS 'Test Comment';
|
||||
|
@ -362,3 +362,73 @@ CREATE RULE rule3 AS
|
||||
--
|
||||
|
||||
REFRESH MATERIALIZED VIEW target."MView";
|
||||
|
||||
-- Collation scripts
|
||||
CREATE COLLATION target.coll_tar
|
||||
FROM pg_catalog."POSIX";
|
||||
|
||||
ALTER COLLATION target.coll_tar
|
||||
OWNER TO enterprisedb;
|
||||
|
||||
CREATE COLLATION target.coll_diff
|
||||
(LC_COLLATE = 'C', LC_CTYPE = 'C');
|
||||
|
||||
ALTER COLLATION target.coll_diff
|
||||
OWNER TO enterprisedb;
|
||||
|
||||
-- FTS Configuration scripts
|
||||
CREATE TEXT SEARCH CONFIGURATION target.fts_con_tar (
|
||||
COPY=german
|
||||
);
|
||||
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_tar OWNER TO enterprisedb;
|
||||
|
||||
CREATE TEXT SEARCH CONFIGURATION target.fts_con_diff (
|
||||
PARSER = default
|
||||
);
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_diff ADD MAPPING FOR asciiword WITH dutch_stem;
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_diff ADD MAPPING FOR email WITH simple;
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_diff ADD MAPPING FOR hword WITH german_stem;
|
||||
|
||||
-- FTS Dictionary scripts
|
||||
CREATE TEXT SEARCH DICTIONARY target.fts_dict_tar (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'english'
|
||||
);
|
||||
|
||||
CREATE TEXT SEARCH DICTIONARY target.fts_dict_diff (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'german'
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH DICTIONARY target.fts_dict_diff
|
||||
IS 'Comment';
|
||||
|
||||
-- FTS Parser scripts
|
||||
CREATE TEXT SEARCH PARSER target.fts_par_tar (
|
||||
START = prsd_start,
|
||||
GETTOKEN = prsd_nexttoken,
|
||||
END = prsd_end,
|
||||
LEXTYPES = prsd_lextype);
|
||||
|
||||
CREATE TEXT SEARCH PARSER target.fts_par_diff (
|
||||
START = int4_accum,
|
||||
GETTOKEN = inet_gist_penalty,
|
||||
END = btint2sortsupport,
|
||||
LEXTYPES = dispell_init);
|
||||
|
||||
COMMENT ON TEXT SEARCH PARSER target.fts_par_diff
|
||||
IS 'Comment';
|
||||
|
||||
-- FTS Template scripts
|
||||
CREATE TEXT SEARCH TEMPLATE target.fts_templ_tar (
|
||||
INIT = dispell_init,
|
||||
LEXIZE = dispell_lexize
|
||||
);
|
||||
|
||||
CREATE TEXT SEARCH TEMPLATE target.fts_templ_diff (
|
||||
INIT = dsimple_init,
|
||||
LEXIZE = dsimple_lexize
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH TEMPLATE target.fts_templ_diff IS 'Comment';
|
||||
|
@ -309,3 +309,90 @@ COMMENT ON RULE rule1 ON source.table_for_rule IS 'comments';
|
||||
CREATE RULE rule2 AS
|
||||
ON INSERT TO source.table_for_rule DO NOTHING;
|
||||
|
||||
-- Collation scripts
|
||||
CREATE COLLATION source.coll_src
|
||||
FROM pg_catalog."default";
|
||||
|
||||
ALTER COLLATION source.coll_src
|
||||
OWNER TO enterprisedb;
|
||||
|
||||
COMMENT ON COLLATION source.coll_src
|
||||
IS 'Test Comment';
|
||||
|
||||
CREATE COLLATION source.coll_diff
|
||||
FROM pg_catalog."default";
|
||||
|
||||
ALTER COLLATION source.coll_diff
|
||||
OWNER TO enterprisedb;
|
||||
|
||||
COMMENT ON COLLATION source.coll_diff
|
||||
IS 'Test Comment';
|
||||
|
||||
-- FTS Configuration scripts
|
||||
CREATE TEXT SEARCH CONFIGURATION source.fts_con_src (
|
||||
COPY=german
|
||||
);
|
||||
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_src OWNER TO enterprisedb;
|
||||
|
||||
COMMENT ON TEXT SEARCH CONFIGURATION source.fts_con_src
|
||||
IS 'Test Comment';
|
||||
|
||||
|
||||
CREATE TEXT SEARCH CONFIGURATION source.fts_con_diff (
|
||||
PARSER = default
|
||||
);
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_diff ADD MAPPING FOR asciiword WITH german_stem;
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_diff ADD MAPPING FOR email WITH simple;
|
||||
ALTER TEXT SEARCH CONFIGURATION source.fts_con_diff ADD MAPPING FOR hword WITH dutch_stem;
|
||||
|
||||
-- FTS Dictionary scripts
|
||||
CREATE TEXT SEARCH DICTIONARY source.fts_dict_src (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'english'
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH DICTIONARY source.fts_dict_src
|
||||
IS 'Test Comment';
|
||||
|
||||
CREATE TEXT SEARCH DICTIONARY source.fts_dict_diff (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'english'
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH DICTIONARY source.fts_dict_diff
|
||||
IS 'Test Comment';
|
||||
|
||||
-- FTS Parser scripts
|
||||
CREATE TEXT SEARCH PARSER source.fts_par_src (
|
||||
START = prsd_start,
|
||||
GETTOKEN = prsd_nexttoken,
|
||||
END = prsd_end,
|
||||
LEXTYPES = prsd_lextype);
|
||||
|
||||
COMMENT ON TEXT SEARCH PARSER source.fts_par_src
|
||||
IS 'Test Comment';
|
||||
|
||||
CREATE TEXT SEARCH PARSER source.fts_par_diff (
|
||||
START = prsd_start,
|
||||
GETTOKEN = prsd_nexttoken,
|
||||
END = prsd_end,
|
||||
LEXTYPES = prsd_lextype);
|
||||
|
||||
COMMENT ON TEXT SEARCH PARSER source.fts_par_diff
|
||||
IS 'Test Comment';
|
||||
|
||||
-- FTS Template scripts
|
||||
CREATE TEXT SEARCH TEMPLATE source.fts_templ_src (
|
||||
INIT = dispell_init,
|
||||
LEXIZE = dispell_lexize
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH TEMPLATE source.fts_templ_src IS 'Test Comment';
|
||||
|
||||
CREATE TEXT SEARCH TEMPLATE source.fts_templ_diff (
|
||||
INIT = dispell_init,
|
||||
LEXIZE = dispell_lexize
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH TEMPLATE source.fts_templ_diff IS 'Test Comment';
|
||||
|
@ -335,3 +335,73 @@ CREATE RULE rule3 AS
|
||||
--
|
||||
|
||||
REFRESH MATERIALIZED VIEW target."MView";
|
||||
|
||||
-- Collation scripts
|
||||
CREATE COLLATION target.coll_tar
|
||||
FROM pg_catalog."default";
|
||||
|
||||
ALTER COLLATION target.coll_tar
|
||||
OWNER TO enterprisedb;
|
||||
|
||||
CREATE COLLATION target.coll_diff
|
||||
(LC_COLLATE = 'C', LC_CTYPE = 'C');
|
||||
|
||||
ALTER COLLATION target.coll_diff
|
||||
OWNER TO enterprisedb;
|
||||
|
||||
-- FTS Configuration scripts
|
||||
CREATE TEXT SEARCH CONFIGURATION target.fts_con_tar (
|
||||
COPY=german
|
||||
);
|
||||
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_tar OWNER TO enterprisedb;
|
||||
|
||||
CREATE TEXT SEARCH CONFIGURATION target.fts_con_diff (
|
||||
PARSER = default
|
||||
);
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_diff ADD MAPPING FOR asciiword WITH dutch_stem;
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_diff ADD MAPPING FOR email WITH simple;
|
||||
ALTER TEXT SEARCH CONFIGURATION target.fts_con_diff ADD MAPPING FOR hword WITH german_stem;
|
||||
|
||||
-- FTS Dictionary scripts
|
||||
CREATE TEXT SEARCH DICTIONARY target.fts_dict_tar (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'english'
|
||||
);
|
||||
|
||||
CREATE TEXT SEARCH DICTIONARY target.fts_dict_diff (
|
||||
TEMPLATE = simple,
|
||||
stopwords = 'german'
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH DICTIONARY target.fts_dict_diff
|
||||
IS 'Comment';
|
||||
|
||||
-- FTS Parser scripts
|
||||
CREATE TEXT SEARCH PARSER target.fts_par_tar (
|
||||
START = prsd_start,
|
||||
GETTOKEN = prsd_nexttoken,
|
||||
END = prsd_end,
|
||||
LEXTYPES = prsd_lextype);
|
||||
|
||||
CREATE TEXT SEARCH PARSER target.fts_par_diff (
|
||||
START = int4_accum,
|
||||
GETTOKEN = inet_gist_penalty,
|
||||
END = btint2sortsupport,
|
||||
LEXTYPES = dispell_init);
|
||||
|
||||
COMMENT ON TEXT SEARCH PARSER target.fts_par_diff
|
||||
IS 'Comment';
|
||||
|
||||
-- FTS Template scripts
|
||||
CREATE TEXT SEARCH TEMPLATE target.fts_templ_tar (
|
||||
INIT = dispell_init,
|
||||
LEXIZE = dispell_lexize
|
||||
);
|
||||
|
||||
CREATE TEXT SEARCH TEMPLATE target.fts_templ_diff (
|
||||
INIT = dsimple_init,
|
||||
LEXIZE = dsimple_lexize
|
||||
);
|
||||
|
||||
COMMENT ON TEXT SEARCH TEMPLATE target.fts_templ_diff IS 'Comment';
|
||||
|
@ -165,6 +165,8 @@ class SchemaDiffTestCase(BaseTestGenerator):
|
||||
self.assertEquals(response.status_code, 200)
|
||||
response_data = json.loads(response.data.decode('utf-8'))
|
||||
file_obj.write(response_data['diff_ddl'])
|
||||
elif 'diff_ddl' in diff:
|
||||
file_obj.write(diff['diff_ddl'])
|
||||
|
||||
file_obj.close()
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user