add equals, hashcode and to toString to migration operations
This commit is contained in:
@@ -1,16 +1,22 @@
|
|||||||
package jef.model.migration.operation;
|
package jef.model.migration.operation;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
public class AddFieldOperation implements MigrationOperation {
|
public class AddFieldOperation implements MigrationOperation {
|
||||||
protected final String table;
|
protected final String table;
|
||||||
protected final String field;
|
protected final String field;
|
||||||
protected final String sqlType;
|
protected final String sqlType;
|
||||||
protected final boolean notNull;
|
protected final boolean notNull;
|
||||||
|
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
public static class Builder implements MigrationOperation.Builder<AddFieldOperation> {
|
public static class Builder implements MigrationOperation.Builder<AddFieldOperation> {
|
||||||
protected final String table;
|
protected final String table;
|
||||||
protected final String field;
|
protected final String field;
|
||||||
|
|||||||
@@ -2,12 +2,16 @@ package jef.model.migration.operation;
|
|||||||
|
|
||||||
import jef.model.constraints.ForeignKeyConstraint;
|
import jef.model.constraints.ForeignKeyConstraint;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
public class AddForeignKeyOperation implements MigrationOperation {
|
public class AddForeignKeyOperation implements MigrationOperation {
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String table;
|
private final String table;
|
||||||
@@ -17,6 +21,8 @@ public class AddForeignKeyOperation implements MigrationOperation {
|
|||||||
private final ForeignKeyConstraint.Action onUpdate;
|
private final ForeignKeyConstraint.Action onUpdate;
|
||||||
private final ForeignKeyConstraint.Action onDelete;
|
private final ForeignKeyConstraint.Action onDelete;
|
||||||
|
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
public static class Builder implements MigrationOperation.Builder<AddForeignKeyOperation> {
|
public static class Builder implements MigrationOperation.Builder<AddForeignKeyOperation> {
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String table;
|
private final String table;
|
||||||
|
|||||||
@@ -1,15 +1,21 @@
|
|||||||
package jef.model.migration.operation;
|
package jef.model.migration.operation;
|
||||||
|
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString
|
||||||
public class AddIndexOperation extends AddKeyOperationBase {
|
public class AddIndexOperation extends AddKeyOperationBase {
|
||||||
public AddIndexOperation(String name, String table, List<String> fields) {
|
public AddIndexOperation(String name, String table, List<String> fields) {
|
||||||
super(name, table, fields);
|
super(name, table, fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString
|
||||||
public static class Builder extends AddKeyOperationBase.Builder<AddIndexOperation> {
|
public static class Builder extends AddKeyOperationBase.Builder<AddIndexOperation> {
|
||||||
public Builder(String name, String table, List<String> fields) {
|
public Builder(String name, String table, List<String> fields) {
|
||||||
super(name, table, fields);
|
super(name, table, fields);
|
||||||
|
|||||||
@@ -1,15 +1,21 @@
|
|||||||
package jef.model.migration.operation;
|
package jef.model.migration.operation;
|
||||||
|
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString
|
||||||
public class AddKeyOperation extends AddKeyOperationBase {
|
public class AddKeyOperation extends AddKeyOperationBase {
|
||||||
public AddKeyOperation(String name, String table, List<String> fields) {
|
public AddKeyOperation(String name, String table, List<String> fields) {
|
||||||
super(name, table, fields);
|
super(name, table, fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString
|
||||||
public static class Builder extends AddKeyOperationBase.Builder<AddKeyOperation> {
|
public static class Builder extends AddKeyOperationBase.Builder<AddKeyOperation> {
|
||||||
public Builder(String name, String table, List<String> fields) {
|
public Builder(String name, String table, List<String> fields) {
|
||||||
super(name, table, fields);
|
super(name, table, fields);
|
||||||
|
|||||||
@@ -1,17 +1,23 @@
|
|||||||
package jef.model.migration.operation;
|
package jef.model.migration.operation;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
public abstract class AddKeyOperationBase implements MigrationOperation {
|
public abstract class AddKeyOperationBase implements MigrationOperation {
|
||||||
protected final String name;
|
protected final String name;
|
||||||
protected final String table;
|
protected final String table;
|
||||||
protected final List<String> fields;
|
protected final List<String> fields;
|
||||||
|
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
public abstract static class Builder<T extends AddKeyOperationBase> implements MigrationOperation.Builder<T> {
|
public abstract static class Builder<T extends AddKeyOperationBase> implements MigrationOperation.Builder<T> {
|
||||||
protected final String name;
|
protected final String name;
|
||||||
protected final String table;
|
protected final String table;
|
||||||
|
|||||||
@@ -1,15 +1,21 @@
|
|||||||
package jef.model.migration.operation;
|
package jef.model.migration.operation;
|
||||||
|
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString
|
||||||
public class AddPrimaryKeyOperation extends AddKeyOperationBase {
|
public class AddPrimaryKeyOperation extends AddKeyOperationBase {
|
||||||
public AddPrimaryKeyOperation(String name, String table, List<String> fields) {
|
public AddPrimaryKeyOperation(String name, String table, List<String> fields) {
|
||||||
super(name, table, fields);
|
super(name, table, fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString
|
||||||
public static class Builder extends AddKeyOperationBase.Builder<AddPrimaryKeyOperation> {
|
public static class Builder extends AddKeyOperationBase.Builder<AddPrimaryKeyOperation> {
|
||||||
public Builder(String name, String table, List<String> fields) {
|
public Builder(String name, String table, List<String> fields) {
|
||||||
super(name, table, fields);
|
super(name, table, fields);
|
||||||
|
|||||||
@@ -1,16 +1,22 @@
|
|||||||
package jef.model.migration.operation;
|
package jef.model.migration.operation;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
public class AddTableOperation implements MigrationOperation {
|
public class AddTableOperation implements MigrationOperation {
|
||||||
private final String table;
|
private final String table;
|
||||||
private final List<AddFieldOperation.Builder> fields;
|
private final List<AddFieldOperation.Builder> fields;
|
||||||
|
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
public static class Builder implements MigrationOperation.Builder<AddTableOperation> {
|
public static class Builder implements MigrationOperation.Builder<AddTableOperation> {
|
||||||
private final String table;
|
private final String table;
|
||||||
private final List<AddFieldOperation.Builder> fields;
|
private final List<AddFieldOperation.Builder> fields;
|
||||||
|
|||||||
@@ -1,15 +1,21 @@
|
|||||||
package jef.model.migration.operation;
|
package jef.model.migration.operation;
|
||||||
|
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString
|
||||||
public class AddUniqueKeyOperation extends AddKeyOperationBase {
|
public class AddUniqueKeyOperation extends AddKeyOperationBase {
|
||||||
public AddUniqueKeyOperation(String name, String table, List<String> fields) {
|
public AddUniqueKeyOperation(String name, String table, List<String> fields) {
|
||||||
super(name, table, fields);
|
super(name, table, fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString
|
||||||
public static class Builder extends AddKeyOperationBase.Builder<AddUniqueKeyOperation> {
|
public static class Builder extends AddKeyOperationBase.Builder<AddUniqueKeyOperation> {
|
||||||
public Builder(String name, String table, List<String> fields) {
|
public Builder(String name, String table, List<String> fields) {
|
||||||
super(name, table, fields);
|
super(name, table, fields);
|
||||||
|
|||||||
@@ -1,14 +1,20 @@
|
|||||||
package jef.model.migration.operation;
|
package jef.model.migration.operation;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
public class DropConstraintOperation implements MigrationOperation {
|
public class DropConstraintOperation implements MigrationOperation {
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String table;
|
private final String table;
|
||||||
|
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
public static class Builder implements MigrationOperation.Builder<DropConstraintOperation> {
|
public static class Builder implements MigrationOperation.Builder<DropConstraintOperation> {
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String table;
|
private final String table;
|
||||||
|
|||||||
@@ -1,14 +1,20 @@
|
|||||||
package jef.model.migration.operation;
|
package jef.model.migration.operation;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
public class DropFieldOperation implements MigrationOperation {
|
public class DropFieldOperation implements MigrationOperation {
|
||||||
private final String table;
|
private final String table;
|
||||||
private final String field;
|
private final String field;
|
||||||
|
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
public static class Builder implements MigrationOperation.Builder<DropFieldOperation> {
|
public static class Builder implements MigrationOperation.Builder<DropFieldOperation> {
|
||||||
private final String table;
|
private final String table;
|
||||||
private final String field;
|
private final String field;
|
||||||
|
|||||||
@@ -1,13 +1,19 @@
|
|||||||
package jef.model.migration.operation;
|
package jef.model.migration.operation;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
public class DropTableOperation implements MigrationOperation {
|
public class DropTableOperation implements MigrationOperation {
|
||||||
private final String table;
|
private final String table;
|
||||||
|
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
public static class Builder implements MigrationOperation.Builder<DropTableOperation> {
|
public static class Builder implements MigrationOperation.Builder<DropTableOperation> {
|
||||||
private final String table;
|
private final String table;
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,21 @@
|
|||||||
package jef.model.migration.operation;
|
package jef.model.migration.operation;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
public class RenameFieldOperation implements MigrationOperation {
|
public class RenameFieldOperation implements MigrationOperation {
|
||||||
private final String table;
|
private final String table;
|
||||||
private final String oldName;
|
private final String oldName;
|
||||||
private final String newName;
|
private final String newName;
|
||||||
|
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
public static class Builder implements MigrationOperation.Builder<RenameFieldOperation> {
|
public static class Builder implements MigrationOperation.Builder<RenameFieldOperation> {
|
||||||
private final String table;
|
private final String table;
|
||||||
private final String oldName;
|
private final String oldName;
|
||||||
|
|||||||
@@ -1,14 +1,20 @@
|
|||||||
package jef.model.migration.operation;
|
package jef.model.migration.operation;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
public class RenameTableOperation implements MigrationOperation {
|
public class RenameTableOperation implements MigrationOperation {
|
||||||
private final String oldName;
|
private final String oldName;
|
||||||
private final String newName;
|
private final String newName;
|
||||||
|
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@ToString
|
||||||
public static class Builder implements MigrationOperation.Builder<RenameTableOperation> {
|
public static class Builder implements MigrationOperation.Builder<RenameTableOperation> {
|
||||||
private final String oldName;
|
private final String oldName;
|
||||||
private final String newName;
|
private final String newName;
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
package jef.model.migration.operation;
|
package jef.model.migration.operation;
|
||||||
|
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString
|
||||||
public class UpdateFieldOperation extends AddFieldOperation {
|
public class UpdateFieldOperation extends AddFieldOperation {
|
||||||
private final String newName;
|
private final String newName;
|
||||||
|
|
||||||
@@ -11,6 +15,8 @@ public class UpdateFieldOperation extends AddFieldOperation {
|
|||||||
this.newName = newName;
|
this.newName = newName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString
|
||||||
public static class Builder extends AddFieldOperation.Builder {
|
public static class Builder extends AddFieldOperation.Builder {
|
||||||
private String newName;
|
private String newName;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user