All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kuliginstepan.mongration.entity.ChangesetEntity Maven / Gradle / Ivy

There is a newer version: 2.0.1
Show newest version
package com.kuliginstepan.mongration.entity;

import java.time.Instant;
import lombok.Builder;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.PersistenceConstructor;
import org.springframework.data.mongodb.core.index.CompoundIndex;

@Data
//@Document
//@Document(collection = "#{@mongrationProperties.getChangelogsCollection()}")
@CompoundIndex(def = "{'changeset': 1, 'changelog': 1}", unique = true)
public class ChangesetEntity {

    public static final String CHANGE_SET_KEY = "changeset";
    public static final String CHANGE_LOG_KEY = "changelog";

    @Id
    private String id;
    private final String changeset;
    private final String author;
    private final Instant createdAt;
    private final String changelog;

    @Builder
    public ChangesetEntity(String changeset, String author, String changelog) {
        this.changeset = changeset;
        this.author = author;
        this.changelog = changelog;
        createdAt = Instant.now();
    }

    @PersistenceConstructor
    public ChangesetEntity(String id, String changeset, String author, Instant createdAt, String changelog) {
        this.id = id;
        this.changeset = changeset;
        this.author = author;
        this.createdAt = createdAt;
        this.changelog = changelog;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy