Skip to content

Commit

Permalink
feat: bump extension metadata to 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fboulnois committed Nov 29, 2023
1 parent c341425 commit 3f1f20a
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ COPY . /srv

RUN for v in `seq 13 16`; do pg_buildext build-$v $v; done

RUN cp sql/pg_uuidv7--1.3.sql . && TARGETS=$(find * -name pg_uuidv7.so) \
&& tar -czvf pg_uuidv7.tar.gz $TARGETS pg_uuidv7--1.3.sql pg_uuidv7.control \
&& sha256sum pg_uuidv7.tar.gz $TARGETS pg_uuidv7--1.3.sql pg_uuidv7.control > SHA256SUMS
RUN cp sql/pg_uuidv7--1.4.sql . && TARGETS=$(find * -name pg_uuidv7.so) \
&& tar -czvf pg_uuidv7.tar.gz $TARGETS pg_uuidv7--1.4.sql pg_uuidv7.control \
&& sha256sum pg_uuidv7.tar.gz $TARGETS pg_uuidv7--1.4.sql pg_uuidv7.control > SHA256SUMS

RUN cp ${PG_MAJOR}/pg_uuidv7.so /usr/lib/postgresql/${PG_MAJOR}/lib \
&& cp pg_uuidv7.control /usr/share/postgresql/${PG_MAJOR}/extension \
&& cp pg_uuidv7--1.3.sql /usr/share/postgresql/${PG_MAJOR}/extension
&& cp pg_uuidv7--1.4.sql /usr/share/postgresql/${PG_MAJOR}/extension
6 changes: 3 additions & 3 deletions META.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "pg_uuidv7",
"abstract": "Create UUIDv7 values in Postgres",
"version": "1.3.0",
"version": "1.4.0",
"maintainer": "fboulnois <[email protected]>",
"license": "open_source",
"provides": {
"pg_uuidv7": {
"abstract": "Create UUIDv7 values in Postgres",
"file": "sql/pg_uuidv7--1.3.sql",
"file": "sql/pg_uuidv7--1.4.sql",
"docfile": "README.md",
"version": "1.3.0"
"version": "1.4.0"
}
},
"resources": {
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MODULES = pg_uuidv7
EXTENSION = pg_uuidv7
DATA = sql/pg_uuidv7--1.3.sql
DATA = sql/pg_uuidv7--1.4.sql

TESTS = $(wildcard test/sql/*.sql)
REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS))
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ can be created in parallel in a distributed system.
and extract it to a temporary directory
2. Copy `pg_uuidv7.so` for your Postgres version into the Postgres module
directory
3. Copy `pg_uuidv7--1.3.sql` and `pg_uuidv7.control` into the Postgres extension
3. Copy `pg_uuidv7--1.4.sql` and `pg_uuidv7.control` into the Postgres extension
directory
4. Enable the extension in the database using `CREATE EXTENSION pg_uuidv7;`

```sh
# example shell script to install pg_uuidv7
cd "$(mktemp -d)"
curl -LO "https://github.com/fboulnois/pg_uuidv7/releases/download/v1.3.0/{pg_uuidv7.tar.gz,SHA256SUMS}"
curl -LO "https://github.com/fboulnois/pg_uuidv7/releases/download/v1.4.0/{pg_uuidv7.tar.gz,SHA256SUMS}"
tar xf pg_uuidv7.tar.gz
sha256sum -c SHA256SUMS
PG_MAJOR=$(pg_config --version | sed 's/^.* \([0-9]\{1,\}\).*$/\1/')
cp "$PG_MAJOR/pg_uuidv7.so" "$(pg_config --pkglibdir)"
cp pg_uuidv7--1.3.sql pg_uuidv7.control "$(pg_config --sharedir)/extension"
cp pg_uuidv7--1.4.sql pg_uuidv7.control "$(pg_config --sharedir)/extension"
psql -c "CREATE EXTENSION pg_uuidv7;"
```

Expand Down
2 changes: 1 addition & 1 deletion pg_uuidv7.control
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
comment = 'pg_uuidv7: create UUIDv7 values in postgres'
default_version = '1.3'
default_version = '1.4'
module_pathname = '$libdir/pg_uuidv7'
relocatable = true
20 changes: 20 additions & 0 deletions sql/pg_uuidv7--1.4.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
\echo Use '''CREATE EXTENSION "pg_uuidv7"''' to load this file. \quit

-- 48 bits for ms since unix epoch (rollover in 10899), 74 bits of randomness
CREATE FUNCTION uuid_generate_v7()
RETURNS uuid
AS 'MODULE_PATHNAME', 'uuid_generate_v7'
VOLATILE STRICT LANGUAGE C PARALLEL SAFE;

-- extract the timestamp from a v7 uuid
CREATE FUNCTION uuid_v7_to_timestamptz(uuid)
RETURNS timestamptz
AS 'MODULE_PATHNAME', 'uuid_v7_to_timestamptz'
VOLATILE STRICT LANGUAGE C PARALLEL SAFE;

-- create a v7 uuid from a timestamp
CREATE FUNCTION uuid_timestamptz_to_v7(timestamptz, zero bool = false)
RETURNS uuid
AS 'MODULE_PATHNAME', 'uuid_timestamptz_to_v7'
VOLATILE STRICT LANGUAGE C PARALLEL SAFE;

0 comments on commit 3f1f20a

Please sign in to comment.