如何解决如果退出,activejdbc 迁移器会强制创建 `schema_version` 表
今天我将通过从一台服务器转储演示数据并恢复到另一台服务器来设置另一个开发环境。我还将代码库复制到开发服务器。当我运行将调用迁移的 from cv2 import *
import numpy as np
ImagesSequence=[]
i=0
cap = cv2.VideoCapture(0)
while True:
# Capture frame-by-frame
ret,frame = cap.read()
# display the resulting frame
cv2.imshow('frame',frame)
ImagesSequence.append(cv2.cvtColor(frame,cv2.COLOR_RGB2GRAY))
cv2.imshow('output',ImagesSequence[i].astype(np.uint8))
i=i+1
if cv2.waitKey(60) == ord('q'):
break
# When everything done,release the capture
cap.release()
cv2.destroyAllWindows()
时,它输出
mvn validate
和 javalite 版本
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.ft:xjobs-server >-----------------------
[INFO] Building API server for xJobs service 0.2-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- db-migrator-maven-plugin:2.5-j8:migrate (dev_migrations) @ xjobs-server ---
[INFO] Sourcing database configuration from file: /srv/apps/xjobs-server/src/main/resources/database.properties
[INFO] Environment: development
[INFO] Migrating jdbc:postgresql://localhost:5432/xjobs_deve using migrations at /srv/apps/xjobs-server/src/migrations/
[INFO] Creating schema version table for POSTGREsql DB
[INFO] Executing: create table schema_version (version varchar(32) not null unique,applied_on timestamp not null,duration int not null)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.864 s
[INFO] Finished at: 2021-07-26T00:42:50+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.javalite:db-migrator-maven-plugin:2.5-j8:migrate (dev_migrations) on project xjobs-server: Execution dev_migrations of goal org.javalite:db-migrator-maven-plugin:2.5-j8:migrate Failed: org.javalite.activejdbc.DBException: org.postgresql.util.PsqlException: ERROR: relation "schema_version" already exists,query: create table schema_version (version varchar(32) not null unique,duration int not null) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors,re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions,please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
我检查了 <javalite.version>2.5-j8</javalite.version>
表,它确实存在,并且包含所有迁移序列号。不明白为什么迁移者还需要重新创建表。
-- 更新
schema_version
中的一些配置
pom.xml
解决方法
我创建了一个示例来准确测试您所拥有的场景。幸运的是,JavaLite Migrator 正在按预期工作。
这是示例的链接:https://github.com/javalite/javalite-examples/tree/master/postgresql-example
无论您运行迁移器多少次,它每次都按预期工作:
[INFO] --- db-migrator-maven-plugin:2.5-j8:migrate (dev_migrations) @ postgresql-example ---
[INFO] Sourcing database configuration from file: /home/igor/projects/javalite/javalite-examples/postgresql-example/src/main/resources/database.properties
[INFO] Environment: development.test
[INFO] Migrating jdbc:postgresql://localhost/postgres using migrations at /home/igor/projects/javalite/javalite-examples/postgresql-example/src/migrations/
[INFO] Trying migrations at: /home/igor/projects/javalite/javalite-examples/postgresql-example/src/migrations
[INFO] No new migrations are found
[INFO] Environment: development
[INFO] Migrating jdbc:postgresql://localhost/postgres using migrations at /home/igor/projects/javalite/javalite-examples/postgresql-example/src/migrations/
[INFO] Trying migrations at: /home/igor/projects/javalite/javalite-examples/postgresql-example/src/migrations
[INFO] No new migrations are found
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.460 s
[INFO] Finished at: 2021-07-26T12:39:06-05:00
那么,你为什么有问题?您可能在数据库中有多个架构,并且可见性配置不正确,因此在一种情况下,您会看到 schema_version
表,而在另一种情况下,您看不到。 Oracle 之前也有过类似案例的报道,该修复与消除不同用户下的泄漏表可见性有关。这是您需要集中精力解决问题的地方。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。