-
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Events table #46
Draft
bryanmikaelian
wants to merge
5
commits into
main
Choose a base branch
from
events-table
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Events table #46
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,5 @@ log | |
1 | ||
projects/**/target | ||
development/resources/system.edn | ||
|
||
/tmp |
1 change: 1 addition & 0 deletions
1
components/database/resources/database/migrations/20241120133943-create-events.down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE IF EXISTS events; |
11 changes: 11 additions & 0 deletions
11
components/database/resources/database/migrations/20241120133943-create-events.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CREATE TABLE IF NOT EXISTS events ( | ||
id UUID PRIMARY KEY NOT NULL DEFAULT gen_random_uuid(), | ||
tenant_id BIGINT NOT NULL, | ||
processed BOOLEAN NOT NULL DEFAULT false, | ||
type TEXT NOT NULL, | ||
payload JSONB NOT NULL | ||
); | ||
|
||
--;; | ||
|
||
CREATE INDEX IF NOT EXISTS idx_events_tenant_processed ON events (tenant_id, processed); |
76 changes: 76 additions & 0 deletions
76
components/database/resources/database/migrations/schema.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,77 @@ | ||
-- | ||
-- PostgreSQL database dump | ||
-- | ||
|
||
-- Dumped from database version 16.5 (Debian 16.5-1.pgdg120+1) | ||
-- Dumped by pg_dump version 16.3 | ||
|
||
SET statement_timeout = 0; | ||
SET lock_timeout = 0; | ||
SET idle_in_transaction_session_timeout = 0; | ||
SET client_encoding = 'UTF8'; | ||
SET standard_conforming_strings = on; | ||
SELECT pg_catalog.set_config('search_path', '', false); | ||
SET check_function_bodies = false; | ||
SET xmloption = content; | ||
SET client_min_messages = warning; | ||
SET row_security = off; | ||
|
||
SET default_tablespace = ''; | ||
|
||
SET default_table_access_method = heap; | ||
|
||
-- | ||
-- Name: events; Type: TABLE; Schema: public; Owner: venn | ||
-- | ||
|
||
CREATE TABLE public.events ( | ||
id uuid DEFAULT gen_random_uuid() NOT NULL, | ||
tenant_id bigint NOT NULL, | ||
processed boolean DEFAULT false NOT NULL, | ||
type text NOT NULL, | ||
payload jsonb NOT NULL | ||
); | ||
|
||
|
||
ALTER TABLE public.events OWNER TO venn; | ||
|
||
-- | ||
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: venn | ||
-- | ||
|
||
CREATE TABLE public.schema_migrations ( | ||
id bigint NOT NULL, | ||
applied timestamp without time zone, | ||
description character varying(1024) | ||
); | ||
|
||
|
||
ALTER TABLE public.schema_migrations OWNER TO venn; | ||
|
||
-- | ||
-- Name: events events_pkey; Type: CONSTRAINT; Schema: public; Owner: venn | ||
-- | ||
|
||
ALTER TABLE ONLY public.events | ||
ADD CONSTRAINT events_pkey PRIMARY KEY (id); | ||
|
||
|
||
-- | ||
-- Name: schema_migrations schema_migrations_id_key; Type: CONSTRAINT; Schema: public; Owner: venn | ||
-- | ||
|
||
ALTER TABLE ONLY public.schema_migrations | ||
ADD CONSTRAINT schema_migrations_id_key UNIQUE (id); | ||
|
||
|
||
-- | ||
-- Name: idx_events_tenant_processed; Type: INDEX; Schema: public; Owner: venn | ||
-- | ||
|
||
CREATE INDEX idx_events_tenant_processed ON public.events USING btree (tenant_id, processed); | ||
|
||
|
||
-- | ||
-- PostgreSQL database dump complete | ||
-- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
projects/agent/.clj-kondo/com.github.seancorfield/next.jdbc/config.edn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{:hooks | ||
{:analyze-call | ||
{next.jdbc/with-transaction | ||
hooks.com.github.seancorfield.next-jdbc/with-transaction | ||
next.jdbc/with-transaction+options | ||
hooks.com.github.seancorfield.next-jdbc/with-transaction+options}} | ||
:lint-as {next.jdbc/on-connection clojure.core/with-open | ||
next.jdbc/on-connection+options clojure.core/with-open}} |
34 changes: 34 additions & 0 deletions
34
...kondo/com.github.seancorfield/next.jdbc/hooks/com/github/seancorfield/next_jdbc.clj_kondo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
(ns hooks.com.github.seancorfield.next-jdbc | ||
(:require [clj-kondo.hooks-api :as api])) | ||
|
||
(defn with-transaction | ||
"Expands (with-transaction [tx expr opts] body) | ||
to (let [tx expr] opts body) per clj-kondo examples." | ||
[{:keys [:node]}] | ||
(let [[binding-vec & body] (rest (:children node)) | ||
[sym val opts] (:children binding-vec)] | ||
(when-not (and sym val) | ||
(throw (ex-info "No sym and val provided" {}))) | ||
(let [new-node (api/list-node | ||
(list* | ||
(api/token-node 'let) | ||
(api/vector-node [sym val]) | ||
opts | ||
body))] | ||
{:node new-node}))) | ||
|
||
(defn with-transaction+options | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [clj-kondo] reported by reviewdog 🐶 |
||
"Expands (with-transaction+options [tx expr opts] body) | ||
to (let [tx expr] opts body) per clj-kondo examples." | ||
[{:keys [:node]}] | ||
(let [[binding-vec & body] (rest (:children node)) | ||
[sym val opts] (:children binding-vec)] | ||
(when-not (and sym val) | ||
(throw (ex-info "No sym and val provided" {}))) | ||
(let [new-node (api/list-node | ||
(list* | ||
(api/token-node 'let) | ||
(api/vector-node [sym val]) | ||
opts | ||
body))] | ||
{:node new-node}))) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[clj-kondo] reported by reviewdog 🐶
redefined var #'hooks.com.github.seancorfield.next-jdbc/with-transaction