mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-03 01:40:21 +08:00
Add multi-database data layer
Introduce aether-data-schema and driver-specific schema generation for Postgres, MySQL, and SQLite. Split data backends, lifecycle, repositories, and gateway runtime integration across database drivers. Verified with cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, and cargo test --workspace.
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
-- Generated by aether-data-schema from schema/logical/*.toml.
|
||||
-- Do not edit generated files directly; edit logical schema or explicit overrides instead.
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.system_configs (
|
||||
id character varying(64) NOT NULL,
|
||||
key character varying(255) NOT NULL,
|
||||
value text NOT NULL,
|
||||
description text,
|
||||
created_at bigint NOT NULL,
|
||||
updated_at bigint NOT NULL
|
||||
);
|
||||
|
||||
ALTER TABLE ONLY public.system_configs ADD CONSTRAINT system_configs_pkey PRIMARY KEY (id);
|
||||
ALTER TABLE ONLY public.system_configs ADD CONSTRAINT system_configs_key_key UNIQUE (key);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.auth_modules (
|
||||
id character varying(64) NOT NULL,
|
||||
module_type character varying(128) NOT NULL,
|
||||
enabled boolean DEFAULT true NOT NULL,
|
||||
config jsonb NOT NULL,
|
||||
created_at bigint NOT NULL,
|
||||
updated_at bigint NOT NULL
|
||||
);
|
||||
|
||||
ALTER TABLE ONLY public.auth_modules ADD CONSTRAINT auth_modules_pkey PRIMARY KEY (id);
|
||||
ALTER TABLE ONLY public.auth_modules ADD CONSTRAINT auth_modules_module_type_key UNIQUE (module_type);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.oauth_providers (
|
||||
provider_type character varying(64) NOT NULL,
|
||||
display_name character varying(255) NOT NULL,
|
||||
client_id text NOT NULL,
|
||||
client_secret_encrypted text,
|
||||
authorization_url_override character varying(500),
|
||||
token_url_override character varying(500),
|
||||
userinfo_url_override character varying(500),
|
||||
scopes jsonb,
|
||||
redirect_uri character varying(500) NOT NULL,
|
||||
frontend_callback_url character varying(500) NOT NULL,
|
||||
attribute_mapping jsonb,
|
||||
extra_config jsonb,
|
||||
is_enabled boolean DEFAULT false NOT NULL,
|
||||
created_at bigint NOT NULL,
|
||||
updated_at bigint NOT NULL
|
||||
);
|
||||
|
||||
ALTER TABLE ONLY public.oauth_providers ADD CONSTRAINT oauth_providers_pkey PRIMARY KEY (provider_type);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.ldap_configs (
|
||||
id bigserial NOT NULL,
|
||||
server_url character varying(255) NOT NULL,
|
||||
bind_dn text NOT NULL,
|
||||
bind_password_encrypted text,
|
||||
base_dn text NOT NULL,
|
||||
user_search_filter text DEFAULT '(uid={username})' NOT NULL,
|
||||
username_attr character varying(50) DEFAULT 'uid' NOT NULL,
|
||||
email_attr character varying(50) DEFAULT 'mail' NOT NULL,
|
||||
display_name_attr character varying(50) DEFAULT 'cn' NOT NULL,
|
||||
is_enabled boolean DEFAULT false NOT NULL,
|
||||
is_exclusive boolean DEFAULT false NOT NULL,
|
||||
use_starttls boolean DEFAULT false NOT NULL,
|
||||
connect_timeout integer DEFAULT 10 NOT NULL,
|
||||
created_at bigint NOT NULL,
|
||||
updated_at bigint NOT NULL
|
||||
);
|
||||
|
||||
ALTER TABLE ONLY public.ldap_configs ADD CONSTRAINT ldap_configs_pkey PRIMARY KEY (id);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.user_oauth_links (
|
||||
id character varying(64) NOT NULL,
|
||||
user_id character varying(64) NOT NULL,
|
||||
provider_type character varying(64) NOT NULL,
|
||||
provider_user_id character varying(255) NOT NULL,
|
||||
provider_username character varying(255),
|
||||
provider_email character varying(255),
|
||||
extra_data jsonb,
|
||||
linked_at bigint NOT NULL,
|
||||
last_login_at bigint
|
||||
);
|
||||
|
||||
ALTER TABLE ONLY public.user_oauth_links ADD CONSTRAINT user_oauth_links_pkey PRIMARY KEY (id);
|
||||
ALTER TABLE ONLY public.user_oauth_links ADD CONSTRAINT uq_user_oauth_links_provider_user UNIQUE (provider_type, provider_user_id);
|
||||
ALTER TABLE ONLY public.user_oauth_links ADD CONSTRAINT uq_user_oauth_links_user_provider UNIQUE (user_id, provider_type);
|
||||
CREATE INDEX IF NOT EXISTS user_oauth_links_provider_type_idx ON public.user_oauth_links USING btree (provider_type);
|
||||
CREATE INDEX IF NOT EXISTS user_oauth_links_user_id_idx ON public.user_oauth_links USING btree (user_id);
|
||||
|
||||
Reference in New Issue
Block a user