Add cdb_extension_reload() utility function
This commit is contained in:
parent
c286727181
commit
a92d7d7d37
1
Makefile
1
Makefile
@ -9,6 +9,7 @@ CDBSCRIPTS = \
|
||||
scripts-available/CDB_SearchPath.sql \
|
||||
scripts-available/CDB_DDLTriggers.sql \
|
||||
scripts-available/CDB_ExtensionPost.sql \
|
||||
scripts-available/CDB_ExtensionUtils.sql \
|
||||
$(END)
|
||||
|
||||
UPGRADABLE = \
|
||||
|
4
NEWS
4
NEWS
@ -13,6 +13,10 @@ Enhancements:
|
||||
|
||||
- Include revision info in cdb_version() output (#34)
|
||||
|
||||
New features:
|
||||
|
||||
- Add a cdb_extension_reload() function
|
||||
|
||||
|
||||
0.1.0 - 2014-05-23
|
||||
------------------
|
||||
|
@ -95,3 +95,9 @@ to "V". Example to upgrade a 0.2.0dev version:
|
||||
ALTER EXTENSION cartodb UPDATE TO '0.2.0devnext';
|
||||
ALTER EXTENSION cartodb UPDATE TO '0.2.0dev';
|
||||
```
|
||||
|
||||
Starting with 0.2.0, the in-place reload can be done with an ad-hoc function:
|
||||
|
||||
```sql
|
||||
SELECT cartodb.cdb_extension_reload();
|
||||
```
|
||||
|
13
scripts-available/CDB_ExtensionUtils.sql
Normal file
13
scripts-available/CDB_ExtensionUtils.sql
Normal file
@ -0,0 +1,13 @@
|
||||
CREATE OR REPLACE FUNCTION cartodb.cdb_extension_reload() RETURNS void
|
||||
AS $$
|
||||
DECLARE
|
||||
ver TEXT;
|
||||
sql TEXT;
|
||||
BEGIN
|
||||
ver := split_part(cartodb.cdb_version(), ' ', 1);
|
||||
sql := 'ALTER EXTENSION cartodb UPDATE TO ''' || ver || 'next''';
|
||||
EXECUTE sql;
|
||||
sql := 'ALTER EXTENSION cartodb UPDATE TO ''' || ver || '''';
|
||||
EXECUTE sql;
|
||||
END;
|
||||
$$ language 'plpgsql' VOLATILE;
|
Loading…
Reference in New Issue
Block a user