diff --git a/app/relations/.keep b/app/relations/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/app/relations/teams.rb b/app/relations/teams.rb new file mode 100644 index 0000000..5ee4148 --- /dev/null +++ b/app/relations/teams.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Sparkles + module Relations + class Teams < Sparkles::DB::Relation + schema :teams, infer: true + end + end +end diff --git a/app/repos/.keep b/app/repos/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/app/repos/team_repo.rb b/app/repos/team_repo.rb new file mode 100644 index 0000000..6e621fd --- /dev/null +++ b/app/repos/team_repo.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +module Sparkles + module Repos + class TeamRepo < Sparkles::DB::Repo + end + end +end diff --git a/config/db/migrate/.keep b/config/db/migrate/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/config/db/migrate/20251019150215_create_teams.rb b/config/db/migrate/20251019150215_create_teams.rb new file mode 100644 index 0000000..1765257 --- /dev/null +++ b/config/db/migrate/20251019150215_create_teams.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +ROM::SQL.migration do + # Add your migration here. + # + # See https://guides.hanamirb.org/v2.2/database/migrations/ for details. + change do + create_table :teams do + column :id, String, primary_key: true + + column :name, String, null: false + column :sparklebot_id, String, null: false + column :active, TrueClass, null: false, default: true + + column :access_token, String, null: false + + column :created_at, "timestamptz", null: false + column :updated_at, "timestamptz", null: false + end + end +end diff --git a/config/db/structure.sql b/config/db/structure.sql new file mode 100644 index 0000000..89b6e25 --- /dev/null +++ b/config/db/structure.sql @@ -0,0 +1,75 @@ +-- +-- PostgreSQL database dump +-- + +\restrict b9avj9S7ECUvDnNKr6cLCnAOE5wda1QazNR1lr9pRJRZdr9rBPGUpygtbrcRpQq + +-- Dumped from database version 18.0 (Postgres.app) +-- Dumped by pg_dump version 18.0 (Postgres.app) + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET transaction_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: schema_migrations; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.schema_migrations ( + filename text NOT NULL +); + + +-- +-- Name: teams; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.teams ( + id text NOT NULL, + name text NOT NULL, + sparklebot_id text NOT NULL, + active boolean DEFAULT true NOT NULL, + access_token text NOT NULL, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL +); + + +-- +-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.schema_migrations + ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (filename); + + +-- +-- Name: teams teams_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.teams + ADD CONSTRAINT teams_pkey PRIMARY KEY (id); + + +-- +-- PostgreSQL database dump complete +-- + +\unrestrict b9avj9S7ECUvDnNKr6cLCnAOE5wda1QazNR1lr9pRJRZdr9rBPGUpygtbrcRpQq + +SET search_path TO "$user", public; + +INSERT INTO schema_migrations (filename) VALUES +('20251019150215_create_teams.rb');