edwardotis opened a new issue, #14482:
URL: https://github.com/apache/grails-core/issues/14482
grails 2.5.4
compile "org.grails.plugins:spring-security-core:2.0.0"
runtime ":database-migration:1.4.1"
compile ":postgresql-extensions:4.6.1"
postgres 9.4
ubuntu 14.04
java 8.77
Given the default User and UserRole created by spring security quickstart.
Given the inital user_role table generated by dbm-gorm-diff is:
CREATE TABLE user_role
(
user_id bigint NOT NULL,
role_id bigint NOT NULL,
date_created timestamp with time zone NOT NULL,
last_updated timestamp with time zone NOT NULL,
CONSTRAINT "user_rolePK" PRIMARY KEY (user_id, role_id),
CONSTRAINT "FK_apcc8lxk2xnug8377fatvbn04" FOREIGN KEY (user_id)
REFERENCES users (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "FK_it77eq964jhfqtu54081ebtio" FOREIGN KEY (role_id)
REFERENCES role (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (
OIDS=FALSE
);
ALTER TABLE user_role
OWNER TO postgres;
I want UserRole to be deleted by cascade when user is deleted.
to UserRole.groovy, I added:
static belongsTo = [user: User]
to User.groovy, I added hasMany and an explicit cascade.
```
static hasMany = [userRoles:UserRole]
static mapping = {
table 'users'
password column: '`password`'
userRoles cascade: 'delete'
}
```
When I run dbm-gorm-diff after making those changes to the domain classes, I
would like a way for the tool to optionally provide a migration to add the
cascade to the foreign key constraint.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]