Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 8 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<version>0.2.5-SNAPSHOT</version>

<properties>
<kotlin.version>1.2.21</kotlin.version>
<kotlin.version>1.2.71</kotlin.version>
<dokka.version>0.9.15</dokka.version>
</properties>

Expand All @@ -28,19 +28,14 @@
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-runtime</artifactId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-reflect</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test-junit</artifactId>
Expand Down Expand Up @@ -101,7 +96,12 @@
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>

<configuration><args><arg>-Xallow-kotlin-package</arg></args></configuration>
<configuration>
<args>
<arg>-Xallow-kotlin-package</arg>
</args>
<jvmTarget>1.8</jvmTarget>
</configuration>

<executions>
<execution>
Expand Down Expand Up @@ -204,13 +204,6 @@
<url>https://github.com/orangy/squash</url>
<tag>HEAD</tag>
</scm>
<repositories>
<repository>
<id>bintray-kotlin-eap-1.1</id>
<name>bintray</name>
<url>https://dl.bintray.com/kotlin/kotlin-eap-1.1</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jcenter</id>
Expand All @@ -225,10 +218,5 @@
<name>bintray-kotlin-dokka</name>
<url>https://dl.bintray.com/kotlin/dokka</url>
</pluginRepository>
<pluginRepository>
<id>bintray-kotlin-eap-1.1</id>
<name>bintray</name>
<url>https://dl.bintray.com/kotlin/kotlin-eap-1.1</url>
</pluginRepository>
</pluginRepositories>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ package org.jetbrains.squash.definition
* Represents a definition of a table in a database
*/
open class TableDefinition(name: String? = null) : Table {
override val compoundName = Identifier(name ?: javaClass.simpleName.removeSuffix("Table"))
override val compoundName = Identifier(name ?: run {
val simpleName = javaClass.simpleName
if (simpleName.isNotEmpty())
simpleName
else // anonymous class, remove the package from full name
javaClass.name.substringAfterLast('.').removeSuffix("Table")
})

override fun toString(): String = "$compoundName"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ abstract class DefinitionTests : DatabaseTests {
val id = integer("id").primaryKey()
val name = varchar("name", length = 42)
}
val tableName = TestTable.compoundName.id

withTransaction {
connection.dialect.definition.tableSQL(TestTable).assertSQL {
"CREATE TABLE IF NOT EXISTS ${quote}unnamedTableWithQuotesSQL\$TestTable$1${quote} (id INT NOT NULL, name VARCHAR(42) NOT NULL, CONSTRAINT ${quote}PK_unnamedTableWithQuotesSQL\$TestTable$1${quote} PRIMARY KEY (id))"
"CREATE TABLE IF NOT EXISTS ${quote}$tableName${quote} (id INT NOT NULL, name VARCHAR(42) NOT NULL, CONSTRAINT ${quote}PK_$tableName${quote} PRIMARY KEY (id))"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion squash-mysql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<dependency>
<groupId>com.wix</groupId>
<artifactId>wix-embedded-mysql</artifactId>
<version>2.1.4</version>
<version>4.2.0</version>
<scope>test</scope>
</dependency>

Expand Down
2 changes: 1 addition & 1 deletion squash-postgres/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4.1212</version>
<version>42.2.5</version>
</dependency>

<!--
Expand Down