Setup API (Hasura) console to version changes in code
This commit is contained in:
6
api/config.yaml
Normal file
6
api/config.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
version: 3
|
||||
endpoint: http://localhost:8080
|
||||
metadata_directory: metadata
|
||||
actions:
|
||||
kind: synchronous
|
||||
handler_webhook_baseurl: http://localhost:3000
|
||||
0
api/metadata/actions.graphql
Normal file
0
api/metadata/actions.graphql
Normal file
6
api/metadata/actions.yaml
Normal file
6
api/metadata/actions.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
actions: []
|
||||
custom_types:
|
||||
enums: []
|
||||
input_objects: []
|
||||
objects: []
|
||||
scalars: []
|
||||
1
api/metadata/allow_list.yaml
Normal file
1
api/metadata/allow_list.yaml
Normal file
@ -0,0 +1 @@
|
||||
[]
|
||||
1
api/metadata/api_limits.yaml
Normal file
1
api/metadata/api_limits.yaml
Normal file
@ -0,0 +1 @@
|
||||
{}
|
||||
1
api/metadata/backend_configs.yaml
Normal file
1
api/metadata/backend_configs.yaml
Normal file
@ -0,0 +1 @@
|
||||
{}
|
||||
1
api/metadata/cron_triggers.yaml
Normal file
1
api/metadata/cron_triggers.yaml
Normal file
@ -0,0 +1 @@
|
||||
[]
|
||||
9
api/metadata/databases/databases.yaml
Normal file
9
api/metadata/databases/databases.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
- name: twenty
|
||||
kind: postgres
|
||||
configuration:
|
||||
connection_info:
|
||||
database_url:
|
||||
from_env: HASURA_GRAPHQL_PG_DATABASE_URL
|
||||
isolation_level: read-committed
|
||||
use_prepared_statements: false
|
||||
tables: "!include twenty/tables/tables.yaml"
|
||||
23
api/metadata/databases/twenty/tables/public_tenants.yaml
Normal file
23
api/metadata/databases/twenty/tables/public_tenants.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
table:
|
||||
name: tenants
|
||||
schema: public
|
||||
array_relationships:
|
||||
- name: users
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
column: tenant_id
|
||||
table:
|
||||
name: users
|
||||
schema: public
|
||||
select_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
columns:
|
||||
- id
|
||||
- name
|
||||
- uuid
|
||||
- email_domain
|
||||
filter:
|
||||
users:
|
||||
email:
|
||||
_eq: X-Hasura-User-Email
|
||||
23
api/metadata/databases/twenty/tables/public_users.yaml
Normal file
23
api/metadata/databases/twenty/tables/public_users.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
table:
|
||||
name: users
|
||||
schema: public
|
||||
object_relationships:
|
||||
- name: tenant
|
||||
using:
|
||||
foreign_key_constraint_on: tenant_id
|
||||
select_permissions:
|
||||
- role: user
|
||||
permission:
|
||||
columns:
|
||||
- id
|
||||
- tenant_id
|
||||
- email
|
||||
- first_name
|
||||
- last_name
|
||||
- created_at
|
||||
- updated_at
|
||||
filter:
|
||||
tenant:
|
||||
users:
|
||||
email:
|
||||
_eq: X-Hasura-User-Email
|
||||
2
api/metadata/databases/twenty/tables/tables.yaml
Normal file
2
api/metadata/databases/twenty/tables/tables.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
- "!include public_tenants.yaml"
|
||||
- "!include public_users.yaml"
|
||||
1
api/metadata/graphql_schema_introspection.yaml
Normal file
1
api/metadata/graphql_schema_introspection.yaml
Normal file
@ -0,0 +1 @@
|
||||
disabled_for_roles: []
|
||||
1
api/metadata/inherited_roles.yaml
Normal file
1
api/metadata/inherited_roles.yaml
Normal file
@ -0,0 +1 @@
|
||||
[]
|
||||
1
api/metadata/metrics_config.yaml
Normal file
1
api/metadata/metrics_config.yaml
Normal file
@ -0,0 +1 @@
|
||||
{}
|
||||
1
api/metadata/network.yaml
Normal file
1
api/metadata/network.yaml
Normal file
@ -0,0 +1 @@
|
||||
{}
|
||||
1
api/metadata/opentelemetry.yaml
Normal file
1
api/metadata/opentelemetry.yaml
Normal file
@ -0,0 +1 @@
|
||||
{}
|
||||
1
api/metadata/query_collections.yaml
Normal file
1
api/metadata/query_collections.yaml
Normal file
@ -0,0 +1 @@
|
||||
[]
|
||||
1
api/metadata/remote_schemas.yaml
Normal file
1
api/metadata/remote_schemas.yaml
Normal file
@ -0,0 +1 @@
|
||||
[]
|
||||
1
api/metadata/rest_endpoints.yaml
Normal file
1
api/metadata/rest_endpoints.yaml
Normal file
@ -0,0 +1 @@
|
||||
[]
|
||||
1
api/metadata/version.yaml
Normal file
1
api/metadata/version.yaml
Normal file
@ -0,0 +1 @@
|
||||
version: 3
|
||||
57
api/migrations/twenty/1675027570991_init/up.sql
Normal file
57
api/migrations/twenty/1675027570991_init/up.sql
Normal file
@ -0,0 +1,57 @@
|
||||
SET check_function_bodies = false;
|
||||
CREATE FUNCTION public.set_current_timestamp_updated_at() RETURNS trigger
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
DECLARE
|
||||
_new record;
|
||||
BEGIN
|
||||
_new := NEW;
|
||||
_new."updated_at" = NOW();
|
||||
RETURN _new;
|
||||
END;
|
||||
$$;
|
||||
CREATE TABLE public.tenants (
|
||||
id integer NOT NULL,
|
||||
name text NOT NULL,
|
||||
uuid uuid DEFAULT gen_random_uuid() NOT NULL,
|
||||
email_domain text NOT NULL
|
||||
);
|
||||
CREATE SEQUENCE public.tenants_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
ALTER SEQUENCE public.tenants_id_seq OWNED BY public.tenants.id;
|
||||
CREATE TABLE public.users (
|
||||
id integer NOT NULL,
|
||||
email text NOT NULL,
|
||||
created_at timestamp with time zone DEFAULT now() NOT NULL,
|
||||
updated_at timestamp with time zone DEFAULT now() NOT NULL,
|
||||
first_name text NOT NULL,
|
||||
last_name text NOT NULL,
|
||||
tenant_id integer NOT NULL
|
||||
);
|
||||
CREATE SEQUENCE public.users_id_seq
|
||||
AS integer
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
|
||||
ALTER TABLE ONLY public.tenants ALTER COLUMN id SET DEFAULT nextval('public.tenants_id_seq'::regclass);
|
||||
ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
|
||||
ALTER TABLE ONLY public.tenants
|
||||
ADD CONSTRAINT tenants_email_domain_key UNIQUE (email_domain);
|
||||
ALTER TABLE ONLY public.tenants
|
||||
ADD CONSTRAINT tenants_pkey PRIMARY KEY (id);
|
||||
ALTER TABLE ONLY public.tenants
|
||||
ADD CONSTRAINT tenants_uuid_key UNIQUE (uuid);
|
||||
ALTER TABLE ONLY public.users
|
||||
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
|
||||
CREATE TRIGGER set_public_users_updated_at BEFORE UPDATE ON public.users FOR EACH ROW EXECUTE FUNCTION public.set_current_timestamp_updated_at();
|
||||
COMMENT ON TRIGGER set_public_users_updated_at ON public.users IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
||||
ALTER TABLE ONLY public.users
|
||||
ADD CONSTRAINT users_tenant_id_fkey FOREIGN KEY (tenant_id) REFERENCES public.tenants(id) ON UPDATE RESTRICT ON DELETE RESTRICT;
|
||||
0
api/seeds/twenty/1675183813451_seed.sql
Normal file
0
api/seeds/twenty/1675183813451_seed.sql
Normal file
6
api/seeds/twenty/1675183931547_seed.sql
Normal file
6
api/seeds/twenty/1675183931547_seed.sql
Normal file
@ -0,0 +1,6 @@
|
||||
SET check_function_bodies = false;
|
||||
INSERT INTO public.users (id, email, created_at, updated_at, first_name, last_name, tenant_id) VALUES (1, 'charles@twenty.com', '2023-01-31 16:46:43.02666+00', '2023-01-31 16:46:43.02666+00', 'Charles', 'Bochet', 1);
|
||||
INSERT INTO public.users (id, email, created_at, updated_at, first_name, last_name, tenant_id) VALUES (2, 'charles@ouihelp.twenty.com', '2023-01-31 16:46:49.72368+00', '2023-01-31 16:46:49.72368+00', 'Charles', 'Bochet', 2);
|
||||
INSERT INTO public.users (id, email, created_at, updated_at, first_name, last_name, tenant_id) VALUES (3, 'felix@twenty.com', '2023-01-31 16:47:06.516066+00', '2023-01-31 16:47:06.516066+00', 'Félix', 'Malfait', 1);
|
||||
INSERT INTO public.users (id, email, created_at, updated_at, first_name, last_name, tenant_id) VALUES (4, 'felix@ouihelp.twenty.com', '2023-01-31 16:47:13.684386+00', '2023-01-31 16:47:13.684386+00', 'Félix', 'Malfait', 2);
|
||||
SELECT pg_catalog.setval('public.users_id_seq', 4, true);
|
||||
4
api/seeds/twenty/1675183944004_seed.sql
Normal file
4
api/seeds/twenty/1675183944004_seed.sql
Normal file
@ -0,0 +1,4 @@
|
||||
SET check_function_bodies = false;
|
||||
INSERT INTO public.tenants (id, name, uuid, email_domain) VALUES (1, 'pilot', '8375f69d-47bd-4baa-a3c1-f8aaef8d8b2b', 'twenty.com');
|
||||
INSERT INTO public.tenants (id, name, uuid, email_domain) VALUES (2, 'ouihelp', 'c71becee-2cd6-4b31-827e-6cbef4e66879', 'ouihelp.twenty.com');
|
||||
SELECT pg_catalog.setval('public.tenants_id_seq', 2, true);
|
||||
Reference in New Issue
Block a user