automatically ignore known forwarded addresses, fixes #64
This commit is contained in:
21
vendor/go.mau.fi/util/dbutil/samples/01-sample.sql
vendored
Normal file
21
vendor/go.mau.fi/util/dbutil/samples/01-sample.sql
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
-- v0 -> v3: Sample revision jump
|
||||
CREATE TABLE foo (
|
||||
-- only: postgres
|
||||
key BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
|
||||
-- only: sqlite
|
||||
key INTEGER PRIMARY KEY,
|
||||
|
||||
data JSONB NOT NULL
|
||||
);
|
||||
|
||||
-- only: sqlite until "end only"
|
||||
CREATE TRIGGER test AFTER INSERT ON foo WHEN NEW.data->>'action' = 'delete' BEGIN
|
||||
DELETE FROM test WHERE key <= NEW.data->>'index';
|
||||
END;
|
||||
-- end only sqlite
|
||||
-- only: postgres until "end only"
|
||||
CREATE FUNCTION delete_data() RETURNS TRIGGER LANGUAGE plpgsql AS $$ BEGIN
|
||||
DELETE FROM test WHERE key <= NEW.data->>'index';
|
||||
RETURN NEW;
|
||||
END $$;
|
||||
-- end only postgres
|
||||
4
vendor/go.mau.fi/util/dbutil/samples/04-notxn.sql
vendored
Normal file
4
vendor/go.mau.fi/util/dbutil/samples/04-notxn.sql
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
-- v4: Sample outside transaction
|
||||
-- transaction: off
|
||||
|
||||
INSERT INTO foo VALUES ('meow', '{}');
|
||||
3
vendor/go.mau.fi/util/dbutil/samples/05-compat.sql
vendored
Normal file
3
vendor/go.mau.fi/util/dbutil/samples/05-compat.sql
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
-- v5 (compatible with v3+): Sample backwards-compatible upgrade
|
||||
|
||||
INSERT INTO foo VALUES ('meow 2', '{}');
|
||||
11
vendor/go.mau.fi/util/dbutil/samples/output/01-postgres.sql
vendored
Normal file
11
vendor/go.mau.fi/util/dbutil/samples/output/01-postgres.sql
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
CREATE TABLE foo (
|
||||
key BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
|
||||
|
||||
data JSONB NOT NULL
|
||||
);
|
||||
|
||||
CREATE FUNCTION delete_data() RETURNS TRIGGER LANGUAGE plpgsql AS $$ BEGIN
|
||||
DELETE FROM test WHERE key <= NEW.data->>'index';
|
||||
RETURN NEW;
|
||||
END $$;
|
||||
-- end only postgres
|
||||
10
vendor/go.mau.fi/util/dbutil/samples/output/01-sqlite3.sql
vendored
Normal file
10
vendor/go.mau.fi/util/dbutil/samples/output/01-sqlite3.sql
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
CREATE TABLE foo (
|
||||
key INTEGER PRIMARY KEY,
|
||||
|
||||
data JSONB NOT NULL
|
||||
);
|
||||
|
||||
CREATE TRIGGER test AFTER INSERT ON foo WHEN NEW.data->>'action' = 'delete' BEGIN
|
||||
DELETE FROM test WHERE key <= NEW.data->>'index';
|
||||
END;
|
||||
-- end only sqlite
|
||||
1
vendor/go.mau.fi/util/dbutil/samples/output/04-postgres.sql
vendored
Normal file
1
vendor/go.mau.fi/util/dbutil/samples/output/04-postgres.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
INSERT INTO foo VALUES ('meow', '{}');
|
||||
1
vendor/go.mau.fi/util/dbutil/samples/output/04-sqlite3.sql
vendored
Normal file
1
vendor/go.mau.fi/util/dbutil/samples/output/04-sqlite3.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
INSERT INTO foo VALUES ('meow', '{}');
|
||||
1
vendor/go.mau.fi/util/dbutil/samples/output/05-postgres.sql
vendored
Normal file
1
vendor/go.mau.fi/util/dbutil/samples/output/05-postgres.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
INSERT INTO foo VALUES ('meow 2', '{}');
|
||||
1
vendor/go.mau.fi/util/dbutil/samples/output/05-sqlite3.sql
vendored
Normal file
1
vendor/go.mau.fi/util/dbutil/samples/output/05-sqlite3.sql
vendored
Normal file
@@ -0,0 +1 @@
|
||||
INSERT INTO foo VALUES ('meow 2', '{}');
|
||||
Reference in New Issue
Block a user