Skip to content

Commit

Permalink
Update Deno to 2.1 LTS!
Browse files Browse the repository at this point in the history
Also simplify migrations' SQL
  • Loading branch information
BrunoBernardino committed Nov 29, 2024
1 parent a619a17 commit 6f66bfc
Show file tree
Hide file tree
Showing 15 changed files with 241 additions and 313 deletions.
4 changes: 2 additions & 2 deletions .do/deploy.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ spec:
value: ${db.PORT}
- key: POSTGRESQL_CAFILE
scope: RUN_AND_BUILD_TIME
value: ""
value: ''
databases:
- name: db
engine: PG
production: false
version: "15"
version: '15'
2 changes: 1 addition & 1 deletion .dvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.46.3
2.1.2
4 changes: 2 additions & 2 deletions .github/workflows/cron-check-subscriptions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Cron: Check subscriptions"
name: 'Cron: Check subscriptions'

on:
workflow_dispatch:
Expand All @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
- uses: denoland/setup-deno@v2
with:
deno-version-file: .dvmrc
- env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cron-cleanup.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Cron: Cleanup"
name: 'Cron: Cleanup'

on:
workflow_dispatch:
Expand All @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
- uses: denoland/setup-deno@v2
with:
deno-version-file: .dvmrc
- env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Deploy

on:
push:
branches:
branches:
- main
workflow_dispatch:

Expand All @@ -23,7 +23,7 @@ jobs:
IdentityFile ~/.ssh/server.key
StrictHostKeyChecking no
END
cat ~/.ssh/config
cat ~/.ssh/config
env:
SSH_HOST: ${{ secrets.SSH_HOST }}
SSH_USER: ${{ secrets.SSH_USER }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: "Docker Image"
name: 'Docker Image'

on:
workflow_dispatch:
schedule:
# At 06:01 on the 5th of every month.
- cron: "1 6 5 * *"
- cron: '1 6 5 * *'
push:
branches:
- "main"
- 'main'
release:
types: [published]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
- uses: denoland/setup-deno@v2
with:
deno-version-file: .dvmrc
- run: docker compose pull
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM denoland/deno:1.46.3
FROM denoland/deno:alpine-2.1.2

EXPOSE 8000

Expand Down
208 changes: 26 additions & 182 deletions db-migrations/001-base.pgsql
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,25 @@ SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

CREATE TABLE public.budgetzen_users (
id uuid DEFAULT gen_random_uuid(),
email character varying NOT NULL,
encrypted_key_pair text NOT NULL,
subscription jsonb NOT NULL,
status character varying NOT NULL,
extra jsonb NOT NULL,
created_at timestamp with time zone DEFAULT now()
);

ALTER TABLE ONLY public.budgetzen_users ADD CONSTRAINT budgetzen_users_pkey PRIMARY KEY (id);


CREATE TABLE public.budgetzen_migrations (
id uuid DEFAULT gen_random_uuid(),
name character varying(100) NOT NULL,
executed_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);

--
-- Name: budgetzen_user_sessions; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.budgetzen_user_sessions (
id uuid DEFAULT gen_random_uuid(),
Expand All @@ -23,13 +38,9 @@ CREATE TABLE public.budgetzen_user_sessions (
created_at timestamp with time zone DEFAULT now()
);

ALTER TABLE ONLY public.budgetzen_user_sessions ADD CONSTRAINT budgetzen_user_sessions_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.budgetzen_user_sessions ADD CONSTRAINT budgetzen_user_sessions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.budgetzen_users(id);

ALTER TABLE public.budgetzen_user_sessions OWNER TO postgres;


--
-- Name: budgetzen_verification_codes; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.budgetzen_verification_codes (
id uuid DEFAULT gen_random_uuid(),
Expand All @@ -40,13 +51,9 @@ CREATE TABLE public.budgetzen_verification_codes (
created_at timestamp with time zone DEFAULT now()
);

ALTER TABLE ONLY public.budgetzen_verification_codes ADD CONSTRAINT budgetzen_verification_codes_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.budgetzen_verification_codes ADD CONSTRAINT budgetzen_verification_codes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.budgetzen_users(id);

ALTER TABLE public.budgetzen_verification_codes OWNER TO postgres;


--
-- Name: budgetzen_budgets; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.budgetzen_budgets (
id uuid DEFAULT gen_random_uuid(),
Expand All @@ -57,14 +64,10 @@ CREATE TABLE public.budgetzen_budgets (
extra jsonb NOT NULL
);


ALTER TABLE public.budgetzen_budgets OWNER TO postgres;
ALTER TABLE ONLY public.budgetzen_budgets ADD CONSTRAINT budgetzen_budgets_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.budgetzen_budgets ADD CONSTRAINT budgetzen_budgets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.budgetzen_users(id);


--
-- Name: budgetzen_expenses; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.budgetzen_expenses (
id uuid DEFAULT gen_random_uuid(),
user_id uuid DEFAULT gen_random_uuid(),
Expand All @@ -76,164 +79,5 @@ CREATE TABLE public.budgetzen_expenses (
extra jsonb NOT NULL
);


ALTER TABLE public.budgetzen_expenses OWNER TO postgres;


--
-- Name: budgetzen_users; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.budgetzen_users (
id uuid DEFAULT gen_random_uuid(),
email character varying NOT NULL,
encrypted_key_pair text NOT NULL,
subscription jsonb NOT NULL,
status character varying NOT NULL,
extra jsonb NOT NULL,
created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE public.budgetzen_users OWNER TO postgres;


--
-- Name: budgetzen_migrations; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.budgetzen_migrations (
id uuid DEFAULT gen_random_uuid(),
name character varying(100) NOT NULL,
executed_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);

ALTER TABLE public.budgetzen_migrations OWNER TO postgres;


--
-- Name: budgetzen_user_sessions budgetzen_user_sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.budgetzen_user_sessions
ADD CONSTRAINT budgetzen_user_sessions_pkey PRIMARY KEY (id);


--
-- Name: budgetzen_verification_codes budgetzen_verification_codes_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.budgetzen_verification_codes
ADD CONSTRAINT budgetzen_verification_codes_pkey PRIMARY KEY (id);


--
-- Name: budgetzen_budgets budgetzen_budgets_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.budgetzen_budgets
ADD CONSTRAINT budgetzen_budgets_pkey PRIMARY KEY (id);


--
-- Name: budgetzen_expenses budgetzen_expenses_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.budgetzen_expenses
ADD CONSTRAINT budgetzen_expenses_pkey PRIMARY KEY (id);


--
-- Name: budgetzen_users budgetzen_users_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.budgetzen_users
ADD CONSTRAINT budgetzen_users_pkey PRIMARY KEY (id);


--
-- Name: budgetzen_user_sessions budgetzen_user_sessions_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.budgetzen_user_sessions
ADD CONSTRAINT budgetzen_user_sessions_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.budgetzen_users(id);


--
-- Name: budgetzen_verification_codes budgetzen_verification_codes_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.budgetzen_verification_codes
ADD CONSTRAINT budgetzen_verification_codes_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.budgetzen_users(id);


--
-- Name: budgetzen_budgets budgetzen_budgets_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.budgetzen_budgets
ADD CONSTRAINT budgetzen_budgets_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.budgetzen_users(id);


--
-- Name: budgetzen_expenses budgetzen_expenses_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.budgetzen_expenses
ADD CONSTRAINT budgetzen_expenses_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.budgetzen_users(id);


--
-- Name: TABLE budgetzen_user_sessions; Type: ACL; Schema: public; Owner: postgres
--

GRANT ALL ON TABLE public.budgetzen_user_sessions TO postgres;


--
-- Name: TABLE budgetzen_verification_codes; Type: ACL; Schema: public; Owner: postgres
--

GRANT ALL ON TABLE public.budgetzen_verification_codes TO postgres;


--
-- Name: TABLE budgetzen_budgets; Type: ACL; Schema: public; Owner: postgres
--

GRANT ALL ON TABLE public.budgetzen_budgets TO postgres;


--
-- Name: TABLE budgetzen_expenses; Type: ACL; Schema: public; Owner: postgres
--

GRANT ALL ON TABLE public.budgetzen_expenses TO postgres;


--
-- Name: TABLE budgetzen_users; Type: ACL; Schema: public; Owner: postgres
--

GRANT ALL ON TABLE public.budgetzen_users TO postgres;


--
-- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: public; Owner: postgres
--

ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON SEQUENCES TO postgres;


--
-- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: public; Owner: postgres
--

ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON FUNCTIONS TO postgres;


--
-- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: public; Owner: postgres
--

ALTER DEFAULT PRIVILEGES FOR ROLE postgres IN SCHEMA public GRANT ALL ON TABLES TO postgres;
ALTER TABLE ONLY public.budgetzen_expenses ADD CONSTRAINT budgetzen_expenses_pkey PRIMARY KEY (id);
ALTER TABLE ONLY public.budgetzen_expenses ADD CONSTRAINT budgetzen_expenses_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.budgetzen_users(id);
Loading

0 comments on commit 6f66bfc

Please sign in to comment.