fixied sql
This commit is contained in:
parent
8e5a299753
commit
1e995d878e
|
@ -26,6 +26,7 @@ import eu.dnetlib.openaire.exporter.model.community.CommunityDetails;
|
|||
import eu.dnetlib.openaire.exporter.model.community.CommunityOrganization;
|
||||
import eu.dnetlib.openaire.exporter.model.community.CommunityProject;
|
||||
import eu.dnetlib.openaire.exporter.model.community.CommunitySummary;
|
||||
import eu.dnetlib.openaire.exporter.model.community.CommunityType;
|
||||
import eu.dnetlib.openaire.exporter.model.community.CommunityWritableProperties;
|
||||
import eu.dnetlib.openaire.exporter.model.community.SubCommunity;
|
||||
import eu.dnetlib.openaire.exporter.model.context.IISConfigurationEntry;
|
||||
|
@ -241,6 +242,7 @@ public class CommunityMappingUtils {
|
|||
|
||||
dbsc.setId(sub.getSubCommunityId());
|
||||
dbsc.setParent(sub.getParent());
|
||||
dbsc.setType(CommunityType.subcommunity);
|
||||
dbsc.setCategory(sub.getCategory());
|
||||
dbsc.setName(sub.getLabel());
|
||||
dbsc.setShortName(sub.getLabel());
|
||||
|
|
|
@ -7,25 +7,27 @@ ALTER TABLE communities ADD COLUMN sub_c_claimable boolean;
|
|||
ALTER TABLE communities ADD COLUMN sub_c_browsable boolean;
|
||||
ALTER TABLE communities ADD COLUMN sub_c_params jsonb;
|
||||
|
||||
-- ADD "ON DELETE CASCADE"
|
||||
-- ADD ON DELETE CASCADE
|
||||
ALTER TABLE community_projects DROP CONSTRAINT community_projects_community_fkey;
|
||||
ALTER TABLE community_datasources DROP CONSTRAINT community_datasources_community_fkey;
|
||||
ALTER TABLE community_support_orgs DROP CONSTRAINT community_support_orgs_community_fkey;
|
||||
ALTER TABLE community_orgs DROP CONSTRAINT community_orgs_community_fkey
|
||||
ALTER TABLE community_projects ADD CONSTRAINT community_projects_community_fkey FOREIGN KEY communities(id) ON DELETE CASCADE;;
|
||||
ALTER TABLE community_datasources ADD CONSTRAINT community_datasources_community_fkey FOREIGN KEY communities(id) ON DELETE CASCADE;;
|
||||
ALTER TABLE community_support_orgs ADD CONSTRAINT community_support_orgs_community_fkey FOREIGN KEY communities(id) ON DELETE CASCADE;
|
||||
ALTER TABLE community_orgs ADD CONSTRAINT community_orgs_community_fkey FOREIGN KEY communities(id) ON DELETE CASCADE;
|
||||
|
||||
ALTER TABLE community_orgs DROP CONSTRAINT community_orgs_community_fkey;
|
||||
ALTER TABLE community_projects ADD CONSTRAINT community_projects_community_fkey FOREIGN KEY (community) REFERENCES communities(id) ON DELETE CASCADE;
|
||||
ALTER TABLE community_datasources ADD CONSTRAINT community_datasources_community_fkey FOREIGN KEY (community) REFERENCES communities(id) ON DELETE CASCADE;
|
||||
ALTER TABLE community_support_orgs ADD CONSTRAINT community_support_orgs_community_fkey FOREIGN KEY (community) REFERENCES communities(id) ON DELETE CASCADE;
|
||||
ALTER TABLE community_orgs ADD CONSTRAINT community_orgs_community_fkey FOREIGN KEY (community) REFERENCES communities(id) ON DELETE CASCADE;
|
||||
|
||||
-- NEW INDEX FOR PARENT
|
||||
CREATE INDEX community_sub_c_parent ON communities(sub_c_parent);
|
||||
|
||||
--TODO
|
||||
|
||||
-- COPY OLD sub-community DATA
|
||||
INSERT INTO communities(
|
||||
id,
|
||||
sub_c_parent,
|
||||
name,
|
||||
shortname,
|
||||
type,
|
||||
sub_c_category,
|
||||
sub_c_claimable,
|
||||
sub_c_browsable,
|
||||
|
@ -35,6 +37,7 @@ INSERT INTO communities(
|
|||
coalesce(parent, community),
|
||||
label,
|
||||
label,
|
||||
'subcommunity',
|
||||
category,
|
||||
claim,
|
||||
browsable,
|
||||
|
|
|
@ -11,13 +11,15 @@ CREATE TABLE communities (
|
|||
shortname text NOT NULL, -- in the profile is label
|
||||
displayname text,
|
||||
displayshortname text,
|
||||
-- TODO how to manage this fields for sub-communityies ??
|
||||
type text NOT NULL, -- community, ri, subcommunity
|
||||
description text NOT NULL DEFAULT '',
|
||||
|
||||
-- TODO how to manage this fields for sub-communityies ??
|
||||
status text NOT NULL DEFAULT 'hidden', -- all, manager, hidden, members
|
||||
membership text NOT NULL DEFAULT 'by-invitation', -- open, by-invitation
|
||||
type text NOT NULL, -- community, ri
|
||||
claim text, -- managers-only, members-only, all
|
||||
-- END TODO
|
||||
|
||||
subjects text[],
|
||||
fos text[],
|
||||
sdg text[],
|
||||
|
@ -32,8 +34,8 @@ CREATE TABLE communities (
|
|||
plan text NOT NULL DEFAULT 'Default',
|
||||
-- extension for sub-communities
|
||||
sub_c_parent text REFERENCES communities(id) ON DELETE CASCADE, -- NULL for the main community
|
||||
sub_c_claimable boolean,
|
||||
sub_c_category text,
|
||||
sub_c_claimable boolean,
|
||||
sub_c_browsable boolean,
|
||||
sub_c_params jsonb
|
||||
|
||||
|
@ -55,7 +57,7 @@ CREATE TABLE community_datasources (
|
|||
ds_id text NOT NULL,
|
||||
ds_name text NOT NULL,
|
||||
ds_officialname text NOT NULL,
|
||||
enabled boolean NOT NULL DEFAULT true
|
||||
enabled boolean NOT NULL DEFAULT true,
|
||||
constraints jsonb,
|
||||
deposit boolean NOT NULL DEFAULT false,
|
||||
message text,
|
||||
|
@ -92,4 +94,4 @@ CREATE INDEX community_projects_community ON community_projects(community);
|
|||
CREATE INDEX community_datasources_community ON community_datasources(community);
|
||||
CREATE INDEX community_support_orgs_community ON community_support_orgs(community);
|
||||
CREATE INDEX community_orgs_community ON community_orgs(community);
|
||||
CREATE INDEX community_parent ON communities(parent);
|
||||
CREATE INDEX community_sub_c_parent ON communities(sub_c_parent);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package eu.dnetlib.openaire.exporter.model.community;
|
||||
|
||||
public enum CommunityType {
|
||||
community,
|
||||
ri
|
||||
subcommunity, community, ri
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue