Skip to content

Commit

Permalink
fix detekt warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
vnikolova committed Sep 27, 2024
1 parent 381649d commit 896e50e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package org.example

import org.jetbrains.exposed.dao.id.IntIdTable

const val MAX_VARCHAR_LENGTH = 50

/*
CREATE TABLE IF NOT EXISTS STARWARSFILMS
(ID INT AUTO_INCREMENT PRIMARY KEY,
Expand All @@ -11,6 +13,6 @@ DIRECTOR VARCHAR(50) NOT NULL);
*/
object StarWarsFilms : IntIdTable() {
val sequelId = integer("sequel_id").uniqueIndex()
val name = varchar("name", 50)
val director = varchar("director", 50)
val name = varchar("name", MAX_VARCHAR_LENGTH)
val director = varchar("director", MAX_VARCHAR_LENGTH)
}

This file was deleted.

4 changes: 2 additions & 2 deletions documentation-website/Writerside/topics/DAO-Table-Types.topic
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<p>The following example represents a table with custom columns <code>sequel_id</code>, <code>name</code>,
and <code>director</code>:
</p>
<code-block lang="kotlin" src="exposed-dao/src/main/kotlin/org/example/StarWarsFilmsTable.kt" include-lines="3-4,12-16"/>
<code-block lang="kotlin" src="exposed-dao/src/main/kotlin/org/example/StarWarsFilms.kt" include-lines="3-6,14-18"/>
<p>
<snippet id="IntIdTable-id-generation-note">
The <code>IntIdTable</code> class automatically generates an auto-incrementing integer <code>id</code>
Expand All @@ -59,7 +59,7 @@
When the table is created, it corresponds to the following
SQL query:
</p>
<code-block lang="sql" src="exposed-dao/src/main/kotlin/org/example/StarWarsFilmsTable.kt" include-lines="6-10" />
<code-block lang="sql" src="exposed-dao/src/main/kotlin/org/example/StarWarsFilms.kt" include-lines="8-12" />
<p>
For more information on defining and configuring tables in Exposed, see <a href="Working-with-Tables.topic"/>.
</p>
Expand Down
4 changes: 2 additions & 2 deletions documentation-website/Writerside/topics/Data-Types.topic
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@
}
}
fun Table.dateRange(name: String): Column & lt;DateRange&gt; = registerColumn(name, DateRangeColumnType())
fun Table.dateRange(name: String): Column<DateRange> = registerColumn(name, DateRangeColumnType())
]]></code-block>
<p>These new column types can be used in a table definition:</p>

Expand Down Expand Up @@ -767,7 +767,7 @@
}
</code-block>
<note>
<p style="note">To use the <code>citext</code> data type, the extension must first be enabled in the
<p>To use the <code>citext</code> data type, the extension must first be enabled in the
database by running <code>exec(&quot;CREATE EXTENSION citext;&quot;)</code>.</p>
</note>
<p>String values can then be inserted and queried from the <code>firstName</code> column in a
Expand Down
4 changes: 2 additions & 2 deletions documentation-website/Writerside/topics/Transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ val idsAndContent = transaction {

// with eagerLoading for text fields
object Documents : Table() {
...
//...
val content = text("content", eagerLoading = true)
}

Expand All @@ -59,7 +59,7 @@ to `transaction` function as the first parameter. The `transaction` block withou
val db1 = connect("jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;", "org.h2.Driver", "root", "")
val db2 = connect("jdbc:h2:mem:db2;DB_CLOSE_DELAY=-1;", "org.h2.Driver", "root", "")
transaction(db1) {
...
//...
val result = transaction(db2) {
Table1.selectAll().where { }.map { it[Table1.name] }
}
Expand Down

0 comments on commit 896e50e

Please sign in to comment.