-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Joel Lee
authored and
Joel Lee
committed
Jan 25, 2021
1 parent
583da03
commit 5cfcae7
Showing
4 changed files
with
124 additions
and
3 deletions.
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
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
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,85 @@ | ||
CREATE SCHEMA IF NOT EXISTS auth AUTHORIZATION postgres; | ||
-- auth.users definition | ||
CREATE TABLE auth.users ( | ||
instance_id uuid NULL, | ||
id uuid NOT NULL, | ||
aud varchar(255) NULL, | ||
"role" varchar(255) NULL, | ||
email varchar(255) NULL, | ||
encrypted_password varchar(255) NULL, | ||
confirmed_at timestamptz NULL, | ||
invited_at timestamptz NULL, | ||
confirmation_token varchar(255) NULL, | ||
confirmation_sent_at timestamptz NULL, | ||
recovery_token varchar(255) NULL, | ||
recovery_sent_at timestamptz NULL, | ||
email_change_token varchar(255) NULL, | ||
email_change varchar(255) NULL, | ||
email_change_sent_at timestamptz NULL, | ||
last_sign_in_at timestamptz NULL, | ||
raw_app_meta_data jsonb NULL, | ||
raw_user_meta_data jsonb NULL, | ||
is_super_admin bool NULL, | ||
created_at timestamptz NULL, | ||
updated_at timestamptz NULL, | ||
CONSTRAINT users_pkey PRIMARY KEY (id) | ||
); | ||
CREATE INDEX users_instance_id_email_idx ON auth.users USING btree (instance_id, email); | ||
CREATE INDEX users_instance_id_idx ON auth.users USING btree (instance_id); | ||
-- auth.refresh_tokens definition | ||
CREATE TABLE auth.refresh_tokens ( | ||
instance_id uuid NULL, | ||
id bigserial NOT NULL, | ||
"token" varchar(255) NULL, | ||
user_id varchar(255) NULL, | ||
revoked bool NULL, | ||
created_at timestamptz NULL, | ||
updated_at timestamptz NULL, | ||
CONSTRAINT refresh_tokens_pkey PRIMARY KEY (id) | ||
); | ||
CREATE INDEX refresh_tokens_instance_id_idx ON auth.refresh_tokens USING btree (instance_id); | ||
CREATE INDEX refresh_tokens_instance_id_user_id_idx ON auth.refresh_tokens USING btree (instance_id, user_id); | ||
CREATE INDEX refresh_tokens_token_idx ON auth.refresh_tokens USING btree (token); | ||
-- auth.instances definition | ||
CREATE TABLE auth.instances ( | ||
id uuid NOT NULL, | ||
uuid uuid NULL, | ||
raw_base_config text NULL, | ||
created_at timestamptz NULL, | ||
updated_at timestamptz NULL, | ||
CONSTRAINT instances_pkey PRIMARY KEY (id) | ||
); | ||
-- auth.audit_log_entries definition | ||
CREATE TABLE auth.audit_log_entries ( | ||
instance_id uuid NULL, | ||
id uuid NOT NULL, | ||
payload json NULL, | ||
created_at timestamptz NULL, | ||
CONSTRAINT audit_log_entries_pkey PRIMARY KEY (id) | ||
); | ||
CREATE INDEX audit_logs_instance_id_idx ON auth.audit_log_entries USING btree (instance_id); | ||
-- auth.schema_migrations definition | ||
CREATE TABLE auth.schema_migrations ( | ||
"version" varchar(255) NOT NULL, | ||
CONSTRAINT schema_migrations_pkey PRIMARY KEY ("version") | ||
); | ||
INSERT INTO auth.schema_migrations (version) | ||
VALUES ('20171026211738'), | ||
('20171026211808'), | ||
('20171026211834'), | ||
('20180103212743'), | ||
('20180108183307'), | ||
('20180119214651'), | ||
('20180125194653'); | ||
-- Gets the User ID from the request cookie | ||
create or replace function auth.uid() returns uuid as $$ | ||
select nullif(current_setting('request.jwt.claim.sub', true), '')::uuid; | ||
$$ language sql stable; | ||
-- Gets the User ID from the request cookie | ||
create or replace function auth.role() returns text as $$ | ||
select nullif(current_setting('request.jwt.claim.role', true), '')::text; | ||
$$ language sql stable; | ||
GRANT ALL PRIVILEGES ON SCHEMA auth TO postgres; | ||
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA auth TO postgres; | ||
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA auth TO postgres; | ||
ALTER USER postgres SET search_path = "auth"; |
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,38 @@ | ||
# docker-compose.yml | ||
version: '3' | ||
services: | ||
gotrue: | ||
image: supabase/gotrue:latest | ||
ports: | ||
- '9999:9999' | ||
environment: | ||
GOTRUE_JWT_SECRET: "37c304f8-51aa-419a-a1af-06154e63707a" | ||
GOTRUE_JWT_EXP: 3600 | ||
GOTRUE_DB_DRIVER: postgres | ||
DB_NAMESPACE: auth | ||
API_EXTERNAL_URL: http://localhost | ||
GOTRUE_API_HOST: 0.0.0.0 | ||
PORT: 9999 | ||
GOTRUE_DISABLE_SIGNUP: "false" | ||
GOTRUE_SITE_URL: http://localhost | ||
GOTRUE_MAILER_AUTOCONFIRM: "true" | ||
GOTRUE_LOG_LEVEL: DEBUG | ||
GOTRUE_OPERATOR_TOKEN: super-secret-operator-token | ||
DATABASE_URL: "postgres://postgres:postgres@db:5432/postgres?sslmode=disable" | ||
GOTRUE_EXTERNAL_GOOGLE_ENABLED: "true" | ||
GOTRUE_EXTERNAL_GOOGLE_CLIENT_ID: 53566906701-bmhc1ndue7hild39575gkpimhs06b7ds.apps.googleusercontent.com | ||
GOTRUE_EXTERNAL_GOOGLE_SECRET: Sm3s8RE85rDcS36iMy8YjrpC | ||
GOTRUE_EXTERNAL_GOOGLE_REDIRECT_URI: http://localhost:9999/callback | ||
depends_on: | ||
- db | ||
db: | ||
image: supabase/postgres | ||
ports: | ||
- '5432:5432' | ||
volumes: | ||
- ./db:/docker-entrypoint-initdb.d/ | ||
environment: | ||
POSTGRES_DB: postgres | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_PORT: 5432 |