Refuse to create new extension if legacy code is present on database
Closes #20
This commit is contained in:
parent
02575155ce
commit
ca4ce102bb
2
Makefile
2
Makefile
@ -25,7 +25,7 @@ PGXS := $(shell $(PG_CONFIG) --pgxs)
|
||||
include $(PGXS)
|
||||
|
||||
$(EXTENSION)--$(EXTVERSION).sql: $(CDBSCRIPTS) cartodb_hooks.sql cartodb_version.sql Makefile
|
||||
echo '\echo Use "CREATE EXTENSION cartodb" to load this file. \quit' > $@
|
||||
echo '\echo Use "CREATE EXTENSION $(EXTENSION)" to load this file. \quit' > $@
|
||||
cat $(CDBSCRIPTS) | \
|
||||
sed -e 's/\<public\./cartodb./g' \
|
||||
-e 's/:DATABASE_USERNAME/cdb_org_admin/g' >> $@
|
||||
|
@ -1,3 +1,5 @@
|
||||
DO $$ BEGIN IF EXISTS (SELECT * FROM pg_proc p, pg_namespace n WHERE p.proname = 'cdb_transformtowebmercator' AND p.pronamespace = n.oid AND n.nspname = 'public') THEN RAISE EXCEPTION 'Use CREATE EXTENSION cartodb FROM unpackaged'; END IF; END; $$ LANGUAGE 'plpgsql'; -- forbid duplicated extension
|
||||
|
||||
CREATE OR REPLACE FUNCTION cartodb.CDB_version()
|
||||
RETURNS text AS $$
|
||||
SELECT '@@VERSION@@'::text;
|
||||
|
@ -4,7 +4,7 @@ ver=$1
|
||||
input=cartodb--${ver}.sql
|
||||
output=cartodb--unpackaged--${ver}.sql
|
||||
|
||||
cat ${input} > ${output}
|
||||
cat ${input} | grep -v 'duplicated extension$' > ${output}
|
||||
|
||||
# Migrate CDB_TableMetadata
|
||||
cat >> ${output} <<'EOF'
|
||||
|
Loading…
Reference in New Issue
Block a user