task/3382: Harmonisera tabellnamn #6

Merged
ansv7779 merged 104 commits from task/3382 into develop 2024-11-12 13:33:44 +01:00
2 changed files with 15 additions and 10 deletions
Showing only changes of commit df29afdacc - Show all commits

View File

@ -1,17 +1,26 @@
package se.su.dsv.scipro.system; package se.su.dsv.scipro.system;
import jakarta.persistence.*; import jakarta.persistence.Cacheable;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
tozh4728 marked this conversation as resolved Outdated

Username is one word, not two. User name is a user's name (John Doe) while username is their unique identifier john@doe.example.

Username is one word, not two. User name is a user's name (John Doe) while username is their unique identifier `john@doe.example`.
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import jakarta.persistence.UniqueConstraint;
import java.util.Objects; import java.util.Objects;
tozh4728 marked this conversation as resolved Outdated

Username is one word, not two. User name is a user's name (John Doe) while username is their unique identifier john@doe.example.

Username is one word, not two. User name is a user's name (John Doe) while username is their unique identifier `john@doe.example`.
@Entity @Entity
@Table(name="username", uniqueConstraints={@UniqueConstraint(name = "uk_username", columnNames={"username"})})
@Cacheable(true) @Cacheable(true)
@Table(name="user_name", uniqueConstraints={@UniqueConstraint(name = "uk_user_name", columnNames={"user_name"})})
public class Username extends DomainObject { public class Username extends DomainObject {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id; private Long id;
@Column(name = "user_name", nullable = false) @Column(name = "username", nullable = false)
private String username; private String username;
@ManyToOne(optional=false) @ManyToOne(optional=false)

View File

@ -587,14 +587,10 @@ alter table `username` drop foreign key `FK_17moq4bksxe30ihucce3jovdc`;
alter table `username` drop key `FK_17moq4bksxe30ihucce3jovdc`; alter table `username` drop key `FK_17moq4bksxe30ihucce3jovdc`;
alter table `username` drop key `username_must_be_unique`; alter table `username` drop key `username_must_be_unique`;
rename table `username` to `user_name`; alter table `username` add constraint uk_username unique(username);
alter table `user_name` rename column `username` to `user_name`; alter table `username`
add constraint fk_username_user_id
alter table `user_name` add constraint uk_user_name unique(user_name);
alter table `user_name`
add constraint fk_user_name_user_id
foreign key (user_id) references user (id) foreign key (user_id) references user (id)
on delete cascade on update cascade; on delete cascade on update cascade;