Skip to content

Commit

Permalink
Upgrade Liquibase to latest version; remove final Java source file an…
Browse files Browse the repository at this point in the history
…d need for `clojure -X:deps prep` (#20611)

* Upgrade Liquibase to latest version

* Try adjusting log

* Fix checksums for the TWO migrations with ID = 32

* FINALLY get Liquibase to use Log4j2

* Set Liquibase ConsoleUIService OutputStream to null OutputStream

* Manually define a package for our H2 proxy class so Java 8 works

* Fix package-name determination code

* Update migrations file spec

* `databasechangelog` shouldn't be upper-case

* Lower-case quartz table names

* More MySQL fixes 🔧

* Properties for all the Quartz tables 😢

* Formatting tweaks [ci skip]

* Revert a few more busted changes

* Fix more busted changes

* Bump Liquibase version to 4.8.0 to fix MySQL defaultValueBoolean bug

* OMG I think I finally fixed MySQL

* Remove Java source file and prep-deps code

* Remove two more references to bin/prep.sh

* Minor cleanup

* Revert unneeded changes

* Fix busted indentation

* Don't search inside java/ anymore since it's G-O-N-E

* Appease the namespace linter

* Update src/metabase/db/liquibase/h2.clj
  • Loading branch information
camsaul committed Mar 15, 2022
1 parent faf55fb commit aaf1b60
Show file tree
Hide file tree
Showing 24 changed files with 855 additions and 660 deletions.
4 changes: 0 additions & 4 deletions .github/scripts/run-presto-kerberos-integration-test.sh
Expand Up @@ -48,10 +48,6 @@ keytool -noprompt -import -alias presto-kerberos -keystore $RESOURCES_DIR/cacert
ADDITIONAL_OPTS="SSLKeyStorePath=$RESOURCES_DIR/ssl_keystore.jks&SSLKeyStorePassword=presto\
&SSLTrustStorePath=$RESOURCES_DIR/cacerts-with-presto-ca.jks&SSLTrustStorePassword=changeit"

# Prepare dependencies
source "./bin/prep.sh"
prep_deps

# Set up the environment variables pointing to all of this, and run some tests
DRIVERS=presto-jdbc \
MB_ENABLE_PRESTO_JDBC_DRIVER=true \
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/backend.yml
Expand Up @@ -26,9 +26,6 @@ jobs:
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'eastwood'
- name: Compile Java & AOT Sources
run: |
source ./bin/prep.sh && prep_deps
- run: clojure -X:dev:ee:ee-dev:drivers:drivers-dev:test:eastwood
name: Run Eastwood linter

Expand All @@ -41,8 +38,5 @@ jobs:
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'namespace-decls'
- name: Compile Java & AOT Sources
run: |
source ./bin/prep.sh && prep_deps
- run: clojure -X:dev:ee:ee-dev:drivers:drivers-dev:test:namespace-checker
name: Check ns forms
2 changes: 0 additions & 2 deletions .github/workflows/build-scripts.yml
Expand Up @@ -17,8 +17,6 @@ jobs:
uses: ./.github/actions/prepare-backend
with:
m2-cache-key: 'build-scripts'
- name: Compile Java & AOT Sources
run: source ./bin/prep.sh && prep_deps

- name: Run metabuild-common build script tests
run: clojure -M:test
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/e2e-tests.yml
Expand Up @@ -23,11 +23,6 @@ jobs:
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend

- name: Java/AOT prep
run: |
source "./bin/prep.sh"
prep_deps
- run: ./bin/build version
- run: ./bin/build translations
- run: ./bin/build frontend
Expand Down
3 changes: 0 additions & 3 deletions bin/build
Expand Up @@ -12,8 +12,5 @@ check_clojure_cli
source "./bin/clear-outdated-cpcaches.sh"
clear_outdated_cpcaches

source "./bin/prep.sh"
prep_deps

cd bin/build-mb
clojure -M -m build $@
3 changes: 0 additions & 3 deletions bin/build-driver.sh
Expand Up @@ -19,8 +19,5 @@ check_clojure_cli
source "./bin/clear-outdated-cpcaches.sh"
clear_outdated_cpcaches

source "./bin/prep.sh"
prep_deps

cd bin/build-drivers
clojure -M -m build-driver $@
3 changes: 0 additions & 3 deletions bin/build-drivers.sh
Expand Up @@ -12,8 +12,5 @@ check_clojure_cli
source "./bin/clear-outdated-cpcaches.sh"
clear_outdated_cpcaches

source "./bin/prep.sh"
prep_deps

cd bin/build-drivers
clojure -M -m build-drivers $@
4 changes: 2 additions & 2 deletions bin/clear-outdated-cpcaches.sh
Expand Up @@ -12,7 +12,7 @@ clear_outdated_cpcaches() {
cd "$script_directory/.."
project_root=`pwd`

cpcaches=`find bin java modules -type d -name .cpcache`
cpcaches=`find bin modules -type d -name .cpcache`
if [ -d .cpcache ]; then
cpcaches=".cpcache $cpcaches"
fi
Expand All @@ -21,7 +21,7 @@ clear_outdated_cpcaches() {
return 0
fi

deps_edns="deps.edn $(find bin java modules -type f -name deps.edn)"
deps_edns="deps.edn $(find bin modules -type f -name deps.edn)"

# find the OLDEST cpcache and NEWEST deps.edn files.
oldest_cpcache=""
Expand Down
3 changes: 0 additions & 3 deletions bin/i18n/update-translation-template
Expand Up @@ -20,9 +20,6 @@ cd "$script_directory/../.."
source "./bin/check-clojure-cli.sh"
check_clojure_cli

source "./bin/prep.sh"
prep_deps

POT_NAME="locales/metabase.pot"
POT_BACKEND_NAME="locales/metabase-backend.pot"
# NOTE: hardcoded in .babelrc
Expand Down
3 changes: 0 additions & 3 deletions bin/lint-migrations-file.sh
Expand Up @@ -12,8 +12,5 @@ check_clojure_cli
source "./bin/clear-outdated-cpcaches.sh"
clear_outdated_cpcaches

source "./bin/prep.sh"
prep_deps

cd bin/lint-migrations-file
clojure -M -m lint-migrations-file $@
6 changes: 3 additions & 3 deletions bin/lint-migrations-file/src/lint_migrations_file.clj
Expand Up @@ -106,13 +106,13 @@
(walk/postwalk walk-fn change-set))
(empty? @problem-cols)))

;; TODO -- change sets must be distinct by ID.
(s/def ::databaseChangeLog
(s/and distinct-change-set-ids?
change-set-ids-in-order?
no-bare-blob-or-text-types?
(s/+ (s/alt :property (s/keys :req-un [::property])
:changeSet (s/keys :req-un [::changeSet])))))
(s/+ (s/alt :property (s/keys :req-un [::property])
:objectQuotingStrategy (s/keys :req-un [::objectQuotingStrategy])
:changeSet (s/keys :req-un [::changeSet])))))

(def strict-change-set-cutoff
"All change sets with an ID >= this number will be validated with the strict spec."
Expand Down
39 changes: 0 additions & 39 deletions bin/prep.sh

This file was deleted.

3 changes: 0 additions & 3 deletions bin/release.sh
Expand Up @@ -12,8 +12,5 @@ check_clojure_cli
source "./bin/clear-outdated-cpcaches.sh"
clear_outdated_cpcaches

source "./bin/prep.sh"
prep_deps

cd bin/release
clojure -M -m release $@
20 changes: 1 addition & 19 deletions build.clj
Expand Up @@ -103,25 +103,7 @@
{"Manifest-Version" "1.0"
"Created-By" "Metabase build.clj"
"Build-Jdk-Spec" (System/getProperty "java.specification.version")
"Main-Class" "metabase.core"
"Liquibase-Package" (str/join ","
["liquibase.change"
"liquibase.changelog"
"liquibase.database"
"liquibase.datatype"
"liquibase.diff"
"liquibase.executor"
"liquibase.ext"
"liquibase.lockservice"
"liquibase.logging"
"liquibase.parser"
"liquibase.precondition"
"liquibase.sdk"
"liquibase.serializer"
"liquibase.snapshot"
"liquibase.sqlgenerator"
"liquibase.structure"
"liquibase.structurecompare"])})
"Main-Class" "metabase.core"})

(defn manifest ^Manifest []
(doto (Manifest.)
Expand Down
12 changes: 5 additions & 7 deletions deps.edn
Expand Up @@ -84,7 +84,7 @@
org.apache.logging.log4j/log4j-api {:mvn/version "2.17.1"} ; add compatibility with log4j 1.2
org.apache.logging.log4j/log4j-core {:mvn/version "2.17.1"} ; apache logging framework
org.apache.logging.log4j/log4j-jcl {:mvn/version "2.17.1"} ; allows the commons-logging API to work with log4j 2
org.apache.logging.log4j/log4j-liquibase {:mvn/version "2.17.1"} ; liquibase logging via log4j 2
org.apache.logging.log4j/log4j-jul {:mvn/version "2.17.1"} ; java.util.logging (JUL) -> Log4j2 adapter
org.apache.logging.log4j/log4j-slf4j-impl {:mvn/version "2.17.1"} ; allows the slf4j API to work with log4j 2
org.apache.poi/poi {:mvn/version "5.2.0"} ; Work with Office documents (e.g. Excel spreadsheets) -- newer version than one specified by Docjure
org.apache.poi/poi-ooxml {:mvn/version "5.2.0"
Expand Down Expand Up @@ -114,15 +114,15 @@
org.eclipse.jetty/jetty-server {:mvn/version "9.4.44.v20210927"} ; web server
org.flatland/ordered {:mvn/version "1.15.10"} ; ordered maps & sets
org.graalvm.js/js {:mvn/version "22.0.0.2"} ; JavaScript engine
org.liquibase/liquibase-core {:mvn/version "3.6.3" ; migration management (Java lib)
org.liquibase/liquibase-core {:mvn/version "4.8.0" ; migration management (Java lib)
:exclusions [ch.qos.logback/logback-classic]}
org.mariadb.jdbc/mariadb-java-client {:mvn/version "2.7.5"} ; MySQL/MariaDB driver
org.postgresql/postgresql {:mvn/version "42.3.2"} ; Postgres driver
org.quartz-scheduler/quartz {:mvn/version "2.3.2"} ; Quartz job scheduler, provided by quartzite but this is a newer version.
org.slf4j/slf4j-api {:mvn/version "1.7.35"} ; abstraction for logging frameworks -- allows end user to plug in desired logging framework at deployment time
org.tcrawley/dynapath {:mvn/version "1.1.0"} ; Dynamically add Jars (e.g. Oracle or Vertica) to classpath
org.threeten/threeten-extra {:mvn/version "1.7.0"} ; extra Java 8 java.time classes like DayOfMonth and Quarter
org.yaml/snakeyaml {:mvn/version "1.30"} ; YAML parser (required by liquibase)
org.yaml/snakeyaml {:mvn/version "1.30"} ; YAML parser
potemkin/potemkin {:mvn/version "0.4.5" ; utility macros & fns
:exclusions [riddley/riddley]}
pretty/pretty {:mvn/version "1.0.5"} ; protocol for defining how custom types should be pretty printed
Expand All @@ -142,17 +142,15 @@
org.clojure/tools.namespace]}
user-agent/user-agent {:mvn/version "0.1.0"} ; User-Agent string parser, for Login History page & elsewhere
weavejester/dependency {:mvn/version "0.2.1"} ; Dependency graphs and topological sorting

;; dummy dependency for the Java source file(s)
metabase/java-deps {:local/root "java"}}
}
;; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;; !! PLEASE KEEP NEW DEPENDENCIES ABOVE ALPHABETICALLY ORGANIZED AND ADD COMMENTS EXPLAINING THEM. !!
;; !! *PLEASE DO NOT* ADD NEW ONES TO THE BOTTOM OF THE LIST. !!
;; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


:paths
["src" "shared/src" "resources" "java/target/classes"]
["src" "shared/src" "resources"]

:aliases
{
Expand Down
19 changes: 0 additions & 19 deletions java/build.clj

This file was deleted.

15 changes: 0 additions & 15 deletions java/deps.edn

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions resources/log4j2.xml
Expand Up @@ -28,6 +28,7 @@
<Logger name="metabase.server.middleware" level="DEBUG"/>
<Logger name="metabase.query-processor.async" level="DEBUG"/>
<Logger name="com.mchange" level="ERROR"/>
<Logger name="liquibase" level="ERROR"/>

<Root level="WARN">
<AppenderRef ref="STDOUT"/>
Expand Down

0 comments on commit aaf1b60

Please sign in to comment.