001package io.ebean.annotation; 002 003import java.lang.annotation.ElementType; 004import java.lang.annotation.Repeatable; 005import java.lang.annotation.Retention; 006import java.lang.annotation.RetentionPolicy; 007import java.lang.annotation.Target; 008 009/** 010 * Annotation to specify details for DDL & Migration-generation. (e.g. defaults/renames/...) 011 * This annotation is <b>EXPERMIENTAL</b> and may change. 012 * 013 * @author Roland Praml, FOCONIS AG 014 */ 015@Retention(RetentionPolicy.RUNTIME) 016@Target(ElementType.FIELD) 017@Repeatable(DbMigration.List.class) 018public @interface DbMigration { 019 020 /** 021 * DdlScripts that will be executed before the 'alter' command. 022 * <p> 023 * You may write a custom update routine here. 024 * If you do not specify an SQL here, and this will alter the table 025 * to a non-null column, ebean will autogenerate a statement from 026 * default value like this: 027 * <pre> 028 * UPDATE table SET column = 'foo' WHERE column IS NULL 029 * </pre> 030 */ 031 String[] preAlter() default {}; 032 033 /** 034 * DdlScript that will be executed after the 'alter' command 035 */ 036 String[] postAlter() default {}; 037 038 /** 039 * DdlScript that will be executed before the 'add' command 040 */ 041 String[] preAdd() default {}; 042 043 /** 044 * DdlScript that will be executed after the 'add' command. 045 * You may write certain update scripts here. 046 */ 047 String[] postAdd() default {}; 048 049 /** 050 * Specific platforms this migration change applies to. 051 */ 052 Platform[] platforms() default {}; 053 054 /** 055 * Repeatable support for {@link DbMigration}. 056 */ 057 @Target({ElementType.FIELD}) 058 @Retention(RetentionPolicy.RUNTIME) 059 @interface List { 060 061 DbMigration[] value() default {}; 062 } 063}