You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The text was updated successfully, but these errors were encountered:
edwardotis
changed the title
dbm-gorm-diff not picking up addition of cascade delete
Feature request: dbm-gorm-diff support database cascading delete on foreign keys
May 18, 2016
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.
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.
The text was updated successfully, but these errors were encountered: