Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade slick-migration-api to 0.10.0 #56

Open
wants to merge 39 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
3f7baf2
Upgrade version and fix complication
astamagnusdottir-asana Nov 25, 2024
6f53d44
Fix warnings
astamagnusdottir-asana Nov 25, 2024
f582aa3
Update tests for scala 2.13
astamagnusdottir-asana Nov 25, 2024
22da3be
Upgrade sbt version in CI pipeline
astamagnusdottir-asana Nov 25, 2024
eab0127
Update download of sbt version
astamagnusdottir-asana Nov 26, 2024
956959d
Update version in build properties
astamagnusdottir-asana Nov 26, 2024
a97b7b6
Remove the installation of sbt as it is already installed
astamagnusdottir-asana Nov 26, 2024
8dec704
Use python3 for pip installation
astamagnusdottir-asana Nov 26, 2024
de8902b
Explore what is inside the scala-forklift directory
astamagnusdottir-asana Nov 26, 2024
c832482
Install sbt in home rather than work-directory
astamagnusdottir-asana Nov 26, 2024
f416cf7
Give path with relative full path
astamagnusdottir-asana Nov 26, 2024
eb70ebe
Fix deprecated in syntax
astamagnusdottir-asana Nov 26, 2024
b469e5c
Upgrade slick to 3.5.x
astamagnusdottir-asana Nov 26, 2024
adc0cf1
Upgrade scala 2.13.x version
astamagnusdottir-asana Nov 26, 2024
3a421cd
Upgrade java version used by circle ci
astamagnusdottir-asana Nov 26, 2024
fc50b0a
Separate python dependencies in circle config
astamagnusdottir-asana Nov 26, 2024
35ea7f6
Update pip call to use pip3
astamagnusdottir-asana Nov 26, 2024
b0c93ba
Upgrade derby version
astamagnusdottir-asana Nov 26, 2024
e8bc3f9
Use old mySQL table configuration
astamagnusdottir-asana Nov 26, 2024
6b98453
Upgrade mysql version
astamagnusdottir-asana Nov 26, 2024
462bcef
Fix java upgrade to 11
astamagnusdottir-asana Nov 26, 2024
8e4878e
Upgrade postgres version
astamagnusdottir-asana Nov 26, 2024
0cc9b22
Fix build and remove deprecated MYSQL user
astamagnusdottir-asana Nov 26, 2024
8ddf89a
Fix Symbol usages
astamagnusdottir-asana Nov 26, 2024
bade212
Explicitly importing HikariCP
astamagnusdottir-asana Nov 27, 2024
57b8175
Fix the example build
astamagnusdottir-asana Nov 27, 2024
81bfa8a
Fix incorrect resolver initialization
astamagnusdottir-asana Nov 27, 2024
88b9514
Change the resolver import change in the example
astamagnusdottir-asana Nov 27, 2024
16d9730
Fix resolver combination
astamagnusdottir-asana Nov 27, 2024
4495370
Test out of curiosity to only run 2.13 tests
astamagnusdottir-asana Nov 27, 2024
6c9ab10
Change Derby version to version supported by slick
astamagnusdottir-asana Nov 27, 2024
5ac3f11
Fix missing closing symbol
astamagnusdottir-asana Nov 27, 2024
4473f4d
Upgrade test package versions
astamagnusdottir-asana Nov 27, 2024
31e5189
Fix scala version in circle command
astamagnusdottir-asana Nov 27, 2024
0938b84
Fix snapshot version
astamagnusdottir-asana Nov 27, 2024
568770b
Upgrade the mysql-connector-j library
astamagnusdottir-asana Nov 27, 2024
62726e0
Update logger version
astamagnusdottir-asana Nov 27, 2024
b2e1e32
Upgrade jgit for eclipse
astamagnusdottir-asana Nov 28, 2024
b066c21
Fix slick-migration-api path
astamagnusdottir-asana Nov 29, 2024
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
32 changes: 19 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,43 @@ jobs:
build:
working_directory: ~/scala-forklift
docker:
- image: circleci/openjdk:8
- image: circleci/mysql:5.7.29
- image: cimg/openjdk:11.0.25
- image: cimg/mysql:8.0
environment:
MYSQL_DATABASE: circle_test
MYSQL_USER: root
MYSQL_ALLOW_EMPTY_PASSWORD: true
- image: circleci/postgres:9.6.9
- image: cimg/postgres:9.6.23
environment:
POSTGRES_USER: circleci
POSTGRES_DB: circle_test
environment:
SBT_VERSION: 1.3.7
SBT_VERSION: 1.10.3
steps:
- run: echo 'export ARTIFACT_BUILD=$CIRCLE_PROJECT_REPONAME-$CIRCLE_BUILD_NUM.zip' >> $BASH_ENV
- run:
name: Get sbt binary
name: Install python dependencies
command: |
apt update && apt install -y curl
curl -L -o sbt-$SBT_VERSION.deb https://dl.bintray.com/sbt/debian/sbt-$SBT_VERSION.deb
sudo dpkg -i sbt-$SBT_VERSION.deb
rm sbt-$SBT_VERSION.deb
sudo apt-get update
sudo apt-get install -y sbt python-pip git
pip install awscli
sudo apt-get install -y python3-pip git
pip3 install awscli
sudo apt-get clean && sudo apt-get autoclean
- run:
name: Setup sbt
command: |
cd ..
curl -L -o sbt-$SBT_VERSION.tgz https://github.com/sbt/sbt/releases/download/v$SBT_VERSION/sbt-$SBT_VERSION.tgz
tar -xvf sbt-$SBT_VERSION.tgz
cd sbt/bin
sudo chmod +x sbt
export PATH=$PATH:$(pwd)
cd ~/scala-forklift
- checkout
- restore_cache:
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
key: sbt-cache
- run:
name: Crossompile scala-forklift
name: Crosscompile scala-forklift
command: sbt +compile
- run:
name: Compile tests
Expand All @@ -47,7 +53,7 @@ jobs:
JAVA_OPTS: "-Xms256m -Xmx512m"
- run:
name: Test scala-forklift scala 2.13
command: sbt '++ 2.13.1; test:test'
command: sbt '++ 2.13.14; test:test'
environment:
JAVA_OPTS: "-Xms256m -Xmx512m"
- save_cache:
Expand Down
48 changes: 24 additions & 24 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
val repoKind = SettingKey[String]("repo-kind",
"Maven repository kind (\"snapshots\" or \"releases\")")

lazy val slickVersion = "3.3.3"
lazy val slickVersion = "3.5.2"

lazy val scala212 = "2.12.11"
lazy val scala213 = "2.13.8"
lazy val scala213 = "2.13.14"
lazy val supportedScalaVersions = List(scala212, scala213)

lazy val coreDependencies = libraryDependencies ++= List(
"org.scala-lang" % "scala-compiler" % scalaVersion.value,
"com.typesafe" % "config" % "1.4.2",
"org.eclipse.jgit" % "org.eclipse.jgit" % "4.0.1.201506240215-r"
"com.typesafe" % "config" % "1.4.3",
"org.eclipse.jgit" % "org.eclipse.jgit" % "7.0.0.202409031743-r"
)

lazy val slickDependencies = List(
"com.typesafe.slick" %% "slick" % slickVersion,
"com.typesafe.slick" %% "slick-codegen" % slickVersion,
"io.github.nafg" %% "slick-migration-api" % "0.8.0",
"io.github.nafg.slick-migration-api" %% "slick-migration-api" % "0.10.0",
"org.scala-lang.modules" %% "scala-collection-compat" % "2.8.1"
)

lazy val slickDependenciesWithTests = slickDependencies ++ List(
"org.scalatest" %% "scalatest" % "3.2.12",
"org.scalatest" %% "scalatest" % "3.0.9",
"com.lihaoyi" %% "ammonite-ops" % "2.4.1",
"commons-io" % "commons-io" % "2.6",
"com.typesafe.slick" %% "slick-hikaricp" % slickVersion,
"com.h2database" % "h2" % "2.1.214",
"org.xerial" % "sqlite-jdbc" % "3.8.11.2",// 3.30.1 crashes SQLiteCommandTests
"mysql" % "mysql-connector-java" % "8.0.30",
"org.xerial" % "sqlite-jdbc" % "3.47.1.0",// 3.30.1 crashes SQLiteCommandTests
"com.mysql" % "mysql-connector-j" % "8.0.33",
"org.postgresql" % "postgresql" % "42.5.0",
"org.hsqldb" % "hsqldb" % "2.7.0",
"org.apache.derby" % "derby" % "10.15.2.0",
"org.apache.derby" % "derby" % "10.17.1.0",
"ch.qos.logback" % "logback-classic" % "1.2.11"
).map(_ % "test")

Expand All @@ -44,26 +44,26 @@ lazy val commonSettings = Seq(
scalacOptions += "-feature",
resolvers += Resolver.jcenterRepo,
publishMavenStyle := true,
publishArtifact in Test := false,
Test / publishArtifact := false,
repoKind := { if (version.value.trim.endsWith("SNAPSHOT")) "snapshots"
else "releases" },
else "releases" },
publishTo := { repoKind.value match {
case "snapshots" => Some("snapshots" at
"https://oss.sonatype.org/content/repositories/snapshots")
"https://oss.sonatype.org/content/repositories/snapshots")
case "releases" => Some("releases" at
"https://oss.sonatype.org/service/local/staging/deploy/maven2")
"https://oss.sonatype.org/service/local/staging/deploy/maven2")
}},
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials"),
pomExtra := (
<scm>
<url>[email protected]:lastland/scala-forklift.git</url>
<connection>scm:git:[email protected]:lastland/scala-forklift.git</connection>
</scm>
</scm>
<developers>
<developer>
<id>lastland</id>
<name>Yao Li</name>
</developer>
<developer>
<id>lastland</id>
<name>Yao Li</name>
</developer>
</developers>))

// Derby is running is secured mode since version 10.12.1.1, so security manager must be disabled for tests
Expand All @@ -80,16 +80,16 @@ lazy val root = Project(
lazy val coreProject = Project(
"scala-forklift-core", file("core")).settings(
commonSettings:_*).settings {Seq(
crossScalaVersions := supportedScalaVersions,
coreDependencies
)}
crossScalaVersions := supportedScalaVersions,
coreDependencies
)}

lazy val slickMigrationProject = Project(
"scala-forklift-slick", file("migrations/slick")).dependsOn(
coreProject).settings(commonSettings:_*).settings { Seq(
crossScalaVersions := supportedScalaVersions,
libraryDependencies ++= slickDependenciesWithTests
)}
crossScalaVersions := supportedScalaVersions,
libraryDependencies ++= slickDependenciesWithTests
)}

lazy val plainMigrationProject = Project(
"scala-forklift-plain", file("migrations/plain")).dependsOn(
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ machine:
environment:
JAVA_OPTS: "-Xms256m -Xmx512m"
java:
version: oraclejdk8
version: oraclejdk11
python:
version: 2.7.9
dependencies:
Expand Down
15 changes: 7 additions & 8 deletions example/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,31 @@ addCommandAlias("mgm", "migration_manager/run")
addCommandAlias("mg", "migrations/run")


lazy val slickVersion = "3.3.2"
lazy val slickVersion = "3.5.2"

lazy val forkliftVersion = "0.3.2-SNAPSHOT"
lazy val forkliftVersion = "0.3.3-SNAPSHOT"

lazy val commonSettings = Seq(
organization := "com.liyaos",
version := "2.0",
scalaVersion := "2.13.1",
scalaVersion := "2.13.14",
scalacOptions += "-deprecation",
scalacOptions += "-feature",
resolvers += Resolver.sonatypeRepo("snapshots"),
resolvers ++= Resolver.sonatypeOssRepos("snapshots"),
resolvers += Resolver.jcenterRepo,

)

lazy val loggingDependencies = List(
"org.slf4j" % "slf4j-nop" % "1.6.4" // <- disables logging
"org.slf4j" % "slf4j-nop" % "2.0.16" // <- disables logging
)

lazy val slickDependencies = List(
"com.typesafe.slick" %% "slick" % slickVersion
)

lazy val dbDependencies = List(
"com.typesafe.slick" %% "slick-hikaricp" % slickVersion
,"com.h2database" % "h2" % "1.4.200"
"com.typesafe.slick" %% "slick-hikaricp" % slickVersion,
"com.h2database" % "h2" % "2.3.232"
)

lazy val forkliftDependencies = List(
Expand Down
2 changes: 1 addition & 1 deletion example/project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.3.7
sbt.version=1.10.3
2 changes: 1 addition & 1 deletion migrations/slick/build.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name := "scala-forklift-slick"

parallelExecution in Test := false
Test / parallelExecution := false
2 changes: 1 addition & 1 deletion migrations/slick/src/main/scala/Codegen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ object Glob{
case Some(lists) =>
val filtered = lists.filter{ c => filter(c) }.toList
val childDirs = lists.filter{ c => c.isDirectory && !c.getName.startsWith(".") }
return ( (acc ::: filtered) /: childDirs){ (a, dir) => recursive(dir, a)}
return childDirs.foldLeft(acc ::: filtered){ (a, dir) => recursive(dir, a)}
}
dirs.flatMap{ d => recursive(new File(d), Nil)}
}
Expand Down
8 changes: 4 additions & 4 deletions migrations/slick/src/main/scala/Commands.scala
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,16 @@ trait SlickMigrationCommands
notYetAppliedMigrations.map { migration =>
migration match {
case m: SqlMigrationInterface[_] =>
println(migration.id + " SqlMigration:")
println(s"${migration.id} SqlMigration:")
println("\t" + m.queries.map(_.getDumpInfo.mainInfo).mkString("\n\t"))
case m: SqlResourceMigrationInterface[_] =>
println(migration.id + " SqlResourceMigration:")
println(s"${migration.id} SqlResourceMigration:")
println(m.sqlQueries)
case m: DBIOMigration[_] =>
println(migration.id + " DBIOMigration:")
println(s"${migration.id} DBIOMigration:")
println("\t" + m.code)
case m: APIMigration[_] =>
println(migration.id + " APIMigration:")
println(s"${migration.id} APIMigration:")
println("\t" + m.migration.sql)
}
println("")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import scala.concurrent.duration._
import scala.concurrent.Future
import scala.concurrent.Await
import scala.concurrent.ExecutionContext.Implicits.global
import slick.backend.DatabaseConfig
import slick.basic.DatabaseConfig
import slick.jdbc.JdbcProfile
import slick.jdbc.meta.MTable
import com.liyaos.forklift.core.Migration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ class CommandsTest extends FlatSpec
val dir = TestDir.createTestDir(wd)
val testDir = dir.testPath

implicit def pathToString(path: Path) = path.toString
implicit def pathToString(path: Path): String = path.toString

val unhandled = testDir/'migrations/'src_migrations/'main/'scala
val handled = testDir/'migrations/'src/'main/'scala/'migrations
val unhandled = testDir/Symbol("migrations")/Symbol("src_migrations")/Symbol("main")/Symbol("scala")
val handled = testDir/Symbol("migrations")/Symbol("src")/Symbol("main")/Symbol("scala")/Symbol("migrations")

before {
dir.setup()
Expand Down Expand Up @@ -63,7 +63,7 @@ class CommandsTest extends FlatSpec
%sbt("mg init", "mg update", "mg apply")
%sbt("mg codegen", "mg update", "mg apply")
val file = new File(
testDir/'generated_code/'src/'main/'scala/'datamodel/'v1/'schema/"schema.scala")
testDir/Symbol("generated_code")/Symbol("src")/Symbol("main")/Symbol("scala")/Symbol("datamodel")/Symbol("v1")/Symbol("schema")/Symbol("schema.scala"))
assert(file.exists)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class MigrationDatabaseTest extends FlatSpec
dir.setup()
rm(objDir)
implicit val wd = dir.path
%%git 'init
%%git('config, "user.email", "[email protected]")
%%git('config, "user.name", "Testser")
%%git Symbol("init")
%%git(Symbol("config"), "user.email", "[email protected]")
%%git(Symbol("config"), "user.name", "Testser")
for (file <- filesToWrite) {
write(file, "dummy file")
}
Expand Down
8 changes: 4 additions & 4 deletions migrations/slick/src/test/scala/UnitTests/ConfigFile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import slick.jdbc.JdbcProfile
trait ConfigFile {
this: Tables =>
val path = System.getProperty("user.dir")
val timeout = new Integer(5000)
val timeout = Integer.valueOf(5000)
val driver: String
val dbDriver: String
val dbUrl: String
Expand All @@ -33,7 +33,7 @@ trait ConfigFile {

protected def migrationsMap = {
val tmpDir = tmp.dir()
val handled = tmpDir/'main/'scala
val handled = tmpDir/Symbol("main")/Symbol("scala")
mkdir! handled
val migrationsMap = new HashMap[String, Object]
migrationsMap.put("slick", slickMap)
Expand Down Expand Up @@ -79,7 +79,7 @@ trait SQLiteConfigFile extends ConfigFile with Tables {
trait MySQLConfigFile extends ConfigFile with Tables {
val user = "root"
val driver = "slick.jdbc.MySQLProfile$"
val dbDriver = "com.mysql.jdbc.Driver"
val dbDriver = "com.mysql.cj.jdbc.Driver"
val dbUrl = s"jdbc:mysql://localhost/circle_test?useSSL=false"

val profile = slick.jdbc.MySQLProfile
Expand Down Expand Up @@ -118,7 +118,7 @@ trait DerbyConfigFile extends ConfigFile with Tables {
val driver = "slick.jdbc.DerbyProfile$"
val dbDriver = "org.apache.derby.jdbc.EmbeddedDriver"
val dbUrl = s"jdbc:derby:$path/target/test-${Instant.now.toEpochMilli}.derby.db;create=true"
override val timeout = new Integer(10000)
override val timeout = Integer.valueOf(10000)

val profile = slick.jdbc.DerbyProfile
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import scala.concurrent.Await
import scala.concurrent.ExecutionContext.Implicits.global
import scala.language.postfixOps
import slick.jdbc.meta.MTable
import slick.driver.JdbcProfile
import slick.jdbc.JdbcProfile

trait MigrationTests extends FlatSpec with PrivateMethodTester {
this: ConfigFile with Tables =>
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.3.7
sbt.version=1.10.3
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version in ThisBuild := "0.3.2"
ThisBuild / version := "0.3.3"