spine-framework 0.3.132 → 0.3.133
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -103,14 +103,17 @@ export async function runMigrations(opts: { frameworkOnly?: boolean } = {}): Pro
|
|
|
103
103
|
const statements = splitSqlStatements(sql)
|
|
104
104
|
|
|
105
105
|
try {
|
|
106
|
+
await client.query('BEGIN')
|
|
106
107
|
for (const stmt of statements) await client.query(stmt)
|
|
107
108
|
await client.query(
|
|
108
109
|
`INSERT INTO _spine_migrations (filename) VALUES ($1) ON CONFLICT (filename) DO NOTHING`,
|
|
109
110
|
[name]
|
|
110
111
|
)
|
|
112
|
+
await client.query('COMMIT')
|
|
111
113
|
console.log('✓')
|
|
112
114
|
applied++
|
|
113
115
|
} catch (err: any) {
|
|
116
|
+
await client.query('ROLLBACK').catch(() => {})
|
|
114
117
|
console.log('✗')
|
|
115
118
|
console.error(` ${err.message}`)
|
|
116
119
|
failed++
|
|
@@ -319,7 +319,7 @@ CREATE TABLE IF NOT EXISTS public.account_paths (
|
|
|
319
319
|
ancestor_id uuid NOT NULL REFERENCES public.accounts(id) ON DELETE CASCADE,
|
|
320
320
|
descendant_id uuid NOT NULL REFERENCES public.accounts(id) ON DELETE CASCADE,
|
|
321
321
|
depth integer NOT NULL,
|
|
322
|
-
PRIMARY KEY (ancestor_id, descendant_id)
|
|
322
|
+
PRIMARY KEY (ancestor_id, descendant_id),
|
|
323
323
|
CONSTRAINT chk_account_paths_no_self CHECK (ancestor_id != descendant_id)
|
|
324
324
|
);
|
|
325
325
|
CREATE INDEX IF NOT EXISTS idx_accounts_parent_id ON public.accounts(parent_id);
|
|
@@ -530,10 +530,6 @@ CREATE TRIGGER set_updated_at_account_paths
|
|
|
530
530
|
BEFORE UPDATE ON public.account_paths
|
|
531
531
|
FOR EACH ROW EXECUTE FUNCTION public.set_updated_at();
|
|
532
532
|
|
|
533
|
-
DROP TRIGGER IF EXISTS set_updated_at_people_roles ON public.people_roles;
|
|
534
|
-
CREATE TRIGGER set_updated_at_people_roles
|
|
535
|
-
BEFORE UPDATE ON public.people_roles
|
|
536
|
-
FOR EACH ROW EXECUTE FUNCTION public.set_updated_at();
|
|
537
533
|
|
|
538
534
|
-- RLS policies
|
|
539
535
|
|
|
@@ -634,10 +630,6 @@ CREATE POLICY api_keys_access ON public.api_keys FOR ALL
|
|
|
634
630
|
USING (account_id IN (SELECT public.get_accessible_accounts(auth.uid()))
|
|
635
631
|
OR id = auth.uid() );
|
|
636
632
|
|
|
637
|
-
CREATE POLICY akul_access ON public.api_key_usage_logs FOR ALL
|
|
638
|
-
USING (account_id IN (SELECT public.get_accessible_accounts(auth.uid()))
|
|
639
|
-
);
|
|
640
|
-
|
|
641
633
|
CREATE POLICY logs_access ON public.logs FOR ALL
|
|
642
634
|
USING (account_id IN (SELECT public.get_accessible_accounts(auth.uid()))
|
|
643
635
|
);
|
|
@@ -122,6 +122,7 @@ COMMENT ON COLUMN public.integrations.is_configured IS 'True when required crede
|
|
|
122
122
|
ALTER TABLE public.integrations DROP CONSTRAINT IF EXISTS integrations_app_id_slug_key;
|
|
123
123
|
ALTER TABLE public.integrations ADD CONSTRAINT integrations_app_account_slug_key UNIQUE (app_id, account_id, slug);
|
|
124
124
|
|
|
125
|
+
ALTER TABLE public.integrations DROP CONSTRAINT IF EXISTS fk_integrations_created_by;
|
|
125
126
|
ALTER TABLE public.integrations ADD CONSTRAINT fk_integrations_created_by
|
|
126
127
|
FOREIGN KEY (created_by) REFERENCES public.people(id) ON DELETE SET NULL;
|
|
127
128
|
|
|
@@ -153,6 +154,7 @@ COMMENT ON COLUMN public.api_keys.rate_limit IS 'Requests per rate_limit_window_
|
|
|
153
154
|
|
|
154
155
|
ALTER TABLE public.api_keys ADD CONSTRAINT fk_api_keys_integration
|
|
155
156
|
FOREIGN KEY (integration_id) REFERENCES public.integrations(id) ON DELETE CASCADE;
|
|
157
|
+
ALTER TABLE public.api_keys DROP CONSTRAINT IF EXISTS fk_api_keys_created_by;
|
|
156
158
|
ALTER TABLE public.api_keys ADD CONSTRAINT fk_api_keys_created_by
|
|
157
159
|
FOREIGN KEY (created_by) REFERENCES public.people(id) ON DELETE SET NULL;
|
|
158
160
|
|