exposed-intellij-plugin icon indicating copy to clipboard operation
exposed-intellij-plugin copied to clipboard

Gradle Plugin: import PrimaryKey

Open stefangaller opened this issue 3 years ago • 2 comments

I tried using the Gradle plugin together with Flyway for migrations. When I run generateExposedCode, there is a class generated for the FlywaySchemaHistory table. Strangely, in the generated code it tries to use the following import:

import PrimaryKey

which cannot be found. It should be

import org.jetbrains.exposed.sql.Table.PrimaryKey

or omitted, since Table is already imported.

Here is the generated file:

package dev.bettercoding.generated

import PrimaryKey
import java.time.LocalDateTime
import kotlin.Boolean
import kotlin.Int
import kotlin.String
import org.jetbrains.exposed.sql.Column
import org.jetbrains.exposed.sql.Table
import org.jetbrains.exposed.sql.`java-time`.datetime

object FlywaySchemaHistory : Table("flyway_schema_history") {
  val installedRank: Column<Int> = integer("installed_rank")

  val version: Column<String?> = varchar("version", 50).nullable()

  val description: Column<String> = varchar("description", 200)

  val type: Column<String> = varchar("type", 20)

  val script: Column<String> = varchar("script", 1000)

  val checksum: Column<Int?> = integer("checksum").nullable()

  val installedBy: Column<String> = varchar("installed_by", 100)

  val installedOn: Column<LocalDateTime> = datetime("installed_on")

  val executionTime: Column<Int> = integer("execution_time")

  val success: Column<Boolean> = bool("success").index("flyway_schema_history_s_idx")

  override val primaryKey: PrimaryKey = PrimaryKey(installedRank)
}

I'm using version 0.2.1 of the plugin, with version 8.0.1 of flyway and Postgres 14.

stefangaller avatar Oct 14 '21 12:10 stefangaller

Can you help to fix this bug?

cuong0993 avatar Nov 28 '22 19:11 cuong0993

It is very sad that not even Jetbrains can merge a 1 line fix that affects everyone having primary keys in their tables. 💀

Xirado avatar Aug 28 '24 15:08 Xirado