diff --git a/.gitignore b/.gitignore index d13c73d04d..a103054aed 100644 --- a/.gitignore +++ b/.gitignore @@ -41,12 +41,7 @@ node_modules # Ignore any SQL files copied from build tasks deployment/postgres-init-db/sql/**/*.sql -!deployment/postgres-init-db/sql/ui/init.sql -!deployment/postgres-init-db/sql/ui/tables/view.sql -!deployment/postgres-init-db/sql/ui/tables/extension_roles.sql -!deployment/postgres-init-db/sql/ui/tables/extensions.sql -!deployment/postgres-init-db/sql/ui/tables/schema_migrations.sql -!deployment/postgres-init-db/sql/ui/applied_migrations.sql +!deployment/postgres-init-db/sql/ui # Ignore Gradle project-specific cache directory .gradle diff --git a/deployment/hasura/metadata/databases/AerieUI/tables/public_extension_roles.yaml b/deployment/hasura/metadata/databases/AerieUI/tables/public_extension_roles.yaml index 401b525928..668ba7a755 100644 --- a/deployment/hasura/metadata/databases/AerieUI/tables/public_extension_roles.yaml +++ b/deployment/hasura/metadata/databases/AerieUI/tables/public_extension_roles.yaml @@ -2,7 +2,7 @@ table: name: extension_roles schema: public object_relationships: - - name: extensions + - name: extension using: foreign_key_constraint_on: extension_id select_permissions: diff --git a/deployment/hasura/metadata/databases/AerieUI/tables/public_extensions.yaml b/deployment/hasura/metadata/databases/AerieUI/tables/public_extensions.yaml index 01739a5a9c..6932ed610b 100644 --- a/deployment/hasura/metadata/databases/AerieUI/tables/public_extensions.yaml +++ b/deployment/hasura/metadata/databases/AerieUI/tables/public_extensions.yaml @@ -35,7 +35,7 @@ insert_permissions: update_permissions: - role: aerie_admin permission: - columns: [description, label, url] + columns: [description, label, owner, url] filter: {} delete_permissions: - role: aerie_admin diff --git a/deployment/hasura/migrations/AerieUI/2_extensions/up.sql b/deployment/hasura/migrations/AerieUI/2_extensions/up.sql index 7b4cb7ad84..56c3f4a50a 100644 --- a/deployment/hasura/migrations/AerieUI/2_extensions/up.sql +++ b/deployment/hasura/migrations/AerieUI/2_extensions/up.sql @@ -1,12 +1,12 @@ create table extensions ( - description text, id integer generated always as identity, + description text, label text not null, owner text, url text not null, updated_at timestamptz not null default now(), - constraint extension_primary_key primary key (id) + constraint extensions_primary_key primary key (id) ); comment on table extensions is e'' @@ -22,7 +22,7 @@ comment on column extensions.url is e'' comment on column extensions.updated_at is e'' 'The time the extension was last updated.'; -create or replace function extensions_set_updated_at() +create function extensions_set_updated_at() returns trigger language plpgsql as $$begin new.updated_at = now(); @@ -43,6 +43,7 @@ create table extension_roles ( constraint extension_roles_to_extension foreign key (extension_id) references "extensions" + on update cascade on delete cascade ); diff --git a/deployment/postgres-init-db/sql/ui/tables/extension_roles.sql b/deployment/postgres-init-db/sql/ui/tables/extension_roles.sql index a92ab5124f..07b3495a87 100644 --- a/deployment/postgres-init-db/sql/ui/tables/extension_roles.sql +++ b/deployment/postgres-init-db/sql/ui/tables/extension_roles.sql @@ -7,6 +7,7 @@ create table extension_roles ( constraint extension_roles_to_extension foreign key (extension_id) references "extensions" + on update cascade on delete cascade ); diff --git a/deployment/postgres-init-db/sql/ui/tables/extensions.sql b/deployment/postgres-init-db/sql/ui/tables/extensions.sql index fce6b5c9d4..8753df55c6 100644 --- a/deployment/postgres-init-db/sql/ui/tables/extensions.sql +++ b/deployment/postgres-init-db/sql/ui/tables/extensions.sql @@ -1,12 +1,12 @@ create table extensions ( - description text, id integer generated always as identity, + description text, label text not null, owner text, url text not null, updated_at timestamptz not null default now(), - constraint extension_primary_key primary key (id) + constraint extensions_primary_key primary key (id) ); comment on table extensions is e'' @@ -22,7 +22,7 @@ comment on column extensions.url is e'' comment on column extensions.updated_at is e'' 'The time the extension was last updated.'; -create or replace function extensions_set_updated_at() +create function extensions_set_updated_at() returns trigger language plpgsql as $$begin new.updated_at = now();