mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Support duplicate index detection, max constraint names - Internal changes for DB Migration / DDL generation #369
This commit is contained in:
+2
-2
@@ -17,13 +17,13 @@ public class DdlNamingConventionTest {
|
||||
@Test
|
||||
public void testUniqueConstraintName() throws Exception {
|
||||
|
||||
assertThat(defaultNaming.uniqueConstraintName("[foo_bar]", "[jim]")).isEqualTo("uq_foo_bar_jim");
|
||||
assertThat(defaultNaming.uniqueConstraintName("[foo_bar]", "[jim]", 1)).isEqualTo("uq_foo_bar_jim");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCheckConstraintName() throws Exception {
|
||||
|
||||
assertThat(defaultNaming.checkConstraintName("[foo_bar]", "[jim]")).isEqualTo("ck_foo_bar_jim");
|
||||
assertThat(defaultNaming.checkConstraintName("[foo_bar]", "[jim]", 1)).isEqualTo("ck_foo_bar_jim");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.avaje.ebean.dbmigration.ddlgeneration.platform;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
public class IndexSetTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
BaseTableDdl.IndexSet set = new BaseTableDdl.IndexSet();
|
||||
assertTrue(set.add(new String[]{"one_column"}));
|
||||
assertTrue(set.add(new String[]{"two_column"}));
|
||||
assertFalse(set.add(new String[]{"one_column"}));
|
||||
|
||||
assertTrue(set.add(new String[]{"a", "b"}));
|
||||
assertTrue(set.add(new String[]{"b","c"}));
|
||||
assertTrue(set.add(new String[]{"a"}));
|
||||
assertFalse(set.add(new String[]{"a", "b"}));
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user