Skip to content

Commit

Permalink
chore(MTR): remove tenantid from actor and actormember (#3296)
Browse files Browse the repository at this point in the history
Multi-tenancy removal

Related to https://bonitasoft.atlassian.net/browse/BPM-347
  • Loading branch information
akantcheff authored Dec 20, 2024
1 parent 871fec9 commit a0fd5ad
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,25 @@
**/
package org.bonitasoft.engine.actor.mapping.model;

import javax.persistence.*;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.bonitasoft.engine.persistence.PersistentObject;
import org.bonitasoft.engine.persistence.PersistentObjectId;
import org.bonitasoft.engine.persistence.PlatformPersistentObject;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Entity
@Table(name = "actor")
@IdClass(PersistentObjectId.class)
public class SActor implements PersistentObject {
public class SActor implements PlatformPersistentObject {

@Id
private long tenantId;
@Id
private long id;
@Column
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,21 @@
**/
package org.bonitasoft.engine.actor.mapping.model;

import javax.persistence.*;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.bonitasoft.engine.persistence.PersistentObject;
import org.bonitasoft.engine.persistence.PersistentObjectId;
import org.bonitasoft.engine.persistence.PlatformPersistentObject;

@Data
@NoArgsConstructor
@Entity
@Table(name = "actormember")
@IdClass(PersistentObjectId.class)
public class SActorMember implements PersistentObject {
public class SActorMember implements PlatformPersistentObject {

@Id
private long tenantId;
@Id
private long id;
@Column
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,28 @@ ALTER TABLE arch_contract_data ADD CONSTRAINT uc_acd_scope_name UNIQUE (kind, sc
CREATE INDEX idx_acd_kind_scope_name ON arch_contract_data (kind, scopeId, name);

CREATE TABLE actor (
tenantid BIGINT NOT NULL,
id BIGINT NOT NULL,
scopeId BIGINT NOT NULL,
name VARCHAR(50) NOT NULL,
displayName VARCHAR(75),
description TEXT,
initiator BOOLEAN,
UNIQUE (tenantid, id, scopeId, name),
PRIMARY KEY (tenantid, id)
CONSTRAINT uk_actor_id_scopeid_name UNIQUE (id, scopeId, name),
CONSTRAINT pk_actor PRIMARY KEY (id)
);

CREATE TABLE actormember (
tenantid BIGINT NOT NULL,
id BIGINT NOT NULL,
actorId BIGINT NOT NULL,
userId BIGINT NOT NULL,
groupId BIGINT NOT NULL,
roleId BIGINT NOT NULL,
UNIQUE (tenantid, actorid, userId, groupId, roleId),
PRIMARY KEY (tenantid, id)
CONSTRAINT uk_actormember_actorid_userid_groupid_roleid UNIQUE (actorId, userId, groupId, roleId),
CONSTRAINT pk_actormember PRIMARY KEY (id)
);

ALTER TABLE actormember ADD CONSTRAINT fk_actormember_actorid FOREIGN KEY (actorId) REFERENCES actor(id);

CREATE TABLE category (
tenantid BIGINT NOT NULL,
id BIGINT NOT NULL,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
-- ------------------------------------------------ Foreign Keys -----------------------------------------------
ALTER TABLE actor ADD CONSTRAINT fk_actor_tenantId FOREIGN KEY (tenantid) REFERENCES tenant(id);
ALTER TABLE actormember ADD CONSTRAINT fk_actormember_tenantId FOREIGN KEY (tenantid) REFERENCES tenant(id);
ALTER TABLE actormember ADD CONSTRAINT fk_actormember_actorId FOREIGN KEY (tenantid, actorId) REFERENCES actor(tenantid, id);
ALTER TABLE category ADD CONSTRAINT fk_category_tenantId FOREIGN KEY (tenantid) REFERENCES tenant (id);
ALTER TABLE command ADD CONSTRAINT fk_command_tenantId FOREIGN KEY (tenantid) REFERENCES tenant (id);
ALTER TABLE connector_instance ADD CONSTRAINT fk_connector_instance_tenantId FOREIGN KEY (tenantid) REFERENCES tenant(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,28 @@ ALTER TABLE arch_contract_data ADD CONSTRAINT uc_acd_scope_name UNIQUE (kind, sc
CREATE INDEX idx_acd_kind_scope_name ON arch_contract_data (kind, scopeId, name);

CREATE TABLE actor (
tenantid INT8 NOT NULL,
id INT8 NOT NULL,
scopeId INT8 NOT NULL,
name VARCHAR(50) NOT NULL,
displayName VARCHAR(75),
description TEXT,
initiator BOOLEAN,
UNIQUE (tenantid, id, scopeId, name),
PRIMARY KEY (tenantid, id)
CONSTRAINT uk_actor_id_scopeid_name UNIQUE (id, scopeId, name),
CONSTRAINT pk_actor PRIMARY KEY (id)
);

CREATE TABLE actormember (
tenantid INT8 NOT NULL,
id INT8 NOT NULL,
actorId INT8 NOT NULL,
userId INT8 NOT NULL,
groupId INT8 NOT NULL,
roleId INT8 NOT NULL,
UNIQUE (tenantid, actorid, userId, groupId, roleId),
PRIMARY KEY (tenantid, id)
CONSTRAINT uk_actormember_actorid_userid_groupid_roleid UNIQUE (actorId, userId, groupId, roleId),
CONSTRAINT pk_actormember PRIMARY KEY (id)
);

ALTER TABLE actormember ADD CONSTRAINT fk_actormember_actorid FOREIGN KEY (actorId) REFERENCES actor(id);

CREATE TABLE category (
tenantid INT8 NOT NULL,
id INT8 NOT NULL,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
-- ------------------------------------------------ Foreign Keys -----------------------------------------------
ALTER TABLE actor ADD CONSTRAINT fk_actor_tenantId FOREIGN KEY (tenantid) REFERENCES tenant(id);
ALTER TABLE actormember ADD CONSTRAINT fk_actormember_tenantId FOREIGN KEY (tenantid) REFERENCES tenant(id);
ALTER TABLE actormember ADD CONSTRAINT fk_actormember_actorId FOREIGN KEY (tenantid, actorId) REFERENCES actor(tenantid, id);
ALTER TABLE category ADD CONSTRAINT fk_category_tenantId FOREIGN KEY (tenantid) REFERENCES tenant (id);
ALTER TABLE command ADD CONSTRAINT fk_command_tenantId FOREIGN KEY (tenantid) REFERENCES tenant (id);
ALTER TABLE connector_instance ADD CONSTRAINT fk_connector_instance_tenantId FOREIGN KEY (tenantid) REFERENCES tenant(id);
Expand Down

0 comments on commit a0fd5ad

Please sign in to comment.