我在本地数据库上运行了一个迁移,进行得很顺利。我正在为同一模式的另一个数据库使用另一个。yml文件,但失败并出现错误
! com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'myTable' already exists
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.3.xsd http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<changeSet author="(generated)" id="1501263805585-1">
<createTable catalogName="deployer" schemaName="deployer" tableName="AuthData">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints primaryKey="true"/>
</column>
</createTable>
</changeSet>
<changeSet author="(generated)" id="1501263805585-2">
<createTable catalogName="deployer" schemaName="deployer" tableName="DeployStatus">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints primaryKey="true"/>
</column>
<column name="message" type="VARCHAR(255)"/>
<column name="statusDate" type="VARCHAR(255)"/>
<column name="statusType" type="VARCHAR(255)"/>
<column name="deploy_id" type="BIGINT"/>
</createTable>
</changeSet>
<changeSet author="(generated)" id="1501263805585-3">
<createTable catalogName="deployer" schemaName="deployer" tableName="Service">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints primaryKey="true"/>
</column>
<column name="applicationData" type="VARCHAR(255)"/>
<column name="artifactID" type="VARCHAR(255)"/>
<column name="deployStatus" type="INT"/>
<column name="deployedFrom" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="diskBytes" type="BIGINT"/>
<column name="env" type="VARCHAR(255)"/>
<column name="executionLevel" type="INT"/>
<column name="groupID" type="VARCHAR(255)"/>
<column name="imageTag" type="VARCHAR(255)"/>
<column name="item" type="INT"/>
<column name="jobFqn" type="VARCHAR(255)"/>
<column name="jobStatus" type="INT"/>
<column name="jobUUID" type="VARCHAR(255)"/>
<column name="memBytes" type="BIGINT"/>
<column name="namespace" type="VARCHAR(255)"/>
<column name="numInstances" type="INT">
<constraints nullable="false"/>
</column>
<column name="requestStatus" type="INT"/>
<column name="taskID" type="VARCHAR(255)"/>
<column name="version" type="VARCHAR(255)"/>
<column name="environment_id" type="BIGINT"/>
<column name="networkServiceConfig_id" type="BIGINT"/>
<column name="userRequest_id" type="BIGINT"/>
</createTable>
</changeSet>
<changeSet author="(generated)" id="1501263805585-4">
<createTable catalogName="deployer" schemaName="deployer" tableName="ServiceAppStatus">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints primaryKey="true"/>
</column>
<column name="deployEnded" type="VARCHAR(255)"/>
<column name="deployStarted" type="VARCHAR(255)"/>
<column name="requestReceived" type="VARCHAR(255)"/>
<column name="statusType" type="INT"/>
<column name="undeployEnded" type="VARCHAR(255)"/>
<column name="undeployStarted" type="VARCHAR(255)"/>
<column name="service_id" type="BIGINT"/>
</createTable>
</changeSet>
<changeSet author="(generated)" id="1501263805585-5">
<createTable catalogName="deployer" schemaName="deployer" tableName="ServiceDeploy">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints primaryKey="true"/>
</column>
<column name="artifactId" type="VARCHAR(255)"/>
<column name="deploymentArtifacts" type="VARCHAR(255)"/>
<column name="executionLevel" type="INT"/>
<column name="groupId" type="VARCHAR(255)"/>
<column name="item" type="INT"/>
<column name="serviceTag" type="VARCHAR(255)"/>
<column name="url" type="VARCHAR(255)"/>
<column name="versionId" type="VARCHAR(255)"/>
<column name="deploy_id" type="BIGINT"/>
</createTable>
</changeSet>
<changeSet author="(generated)" id="1501263805585-6">
<createTable catalogName="deployer" schemaName="deployer" tableName="ServiceDeploy_dependentIds">
<column name="ServiceDeploy_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="dependentIds" type="BIGINT"/>
</createTable>
</changeSet>
<changeSet author="spalshik (generated)" id="1501263805585-7">
<createTable catalogName="deployer" schemaName="deployer" tableName="ServiceRoutes_routes">
<column name="ServiceRoutes_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="routes" type="VARCHAR(255)"/>
<column name="routes_KEY" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="(generated)" id="1501263805585-8">
<createTable catalogName="deployer" schemaName="deployer" tableName="ServiceStatus">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints primaryKey="true"/>
</column>
<column name="message" type="VARCHAR(255)"/>
<column name="statusDate" type="VARCHAR(255)"/>
<column name="statusType" type="INT"/>
<column name="serviceDeploy_id" type="BIGINT"/>
</createTable>
</changeSet>
<changeSet author="(generated)" id="1501263805585-9">
<createTable catalogName="deployer" schemaName="deployer" tableName="Service_dependentIds">
<column name="Service_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="dependentIds" type="BIGINT"/>
</createTable>
</changeSet>
<changeSet author="(generated)" id="1501263805585-10">
<createTable catalogName="deployer" schemaName="deployer" tableName="Service_endPoints">
<column name="Service_id" type="BIGINT">
<constraints nullable="false"/>
</column>
<column name="endPoints" type="VARCHAR(255)"/>
<column name="endPoints_KEY" type="VARCHAR(255)">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="(generated)" id="1501263805585-11">
<createTable catalogName="deployer" schemaName="deployer" tableName="UserData">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints primaryKey="true"/>
</column>
</createTable>
</changeSet>
<changeSet author="(generated)" id="1501263805585-12">
<createTable catalogName="deployer" schemaName="deployer" tableName="UserRequestStatus">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints primaryKey="true"/>
</column>
<column name="ended" type="VARCHAR(255)"/>
<column name="received" type="VARCHAR(255)"/>
<column name="started" type="VARCHAR(255)"/>
<column name="statusType" type="VARCHAR(255)"/>
<column name="userRequest_id" type="BIGINT"/>
</createTable>
</changeSet>
<changeSet author="(generated)" id="1501263805585-13">
<createTable catalogName="deployer" schemaName="deployer" tableName="deployer">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints primaryKey="true"/>
</column>
<column name="started" type="datetime"/>
<column name="status" type="VARCHAR(255)"/>
<column name="version" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="(generated)" id="1501263805585-14">
<createTable catalogName="deployer" schemaName="deployer" tableName="deploys">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints primaryKey="true"/>
</column>
<column name="callerId" type="VARCHAR(255)"/>
<column name="context" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="(generated)" id="1501263805585-15">
<createTable catalogName="deployer" schemaName="deployer" tableName="ephemeralEnvironments">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints primaryKey="true"/>
</column>
<column name="environmentType" type="INT"/>
<column name="name" type="VARCHAR(255)"/>
<column name="requestStatus" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="(generated)" id="1501263805585-16">
<createTable catalogName="deployer" schemaName="deployer" tableName="networkServiceConfig">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints primaryKey="true"/>
</column>
<column name="endpoint" type="VARCHAR(255)"/>
<column name="host" type="VARCHAR(255)"/>
<column name="port" type="INT">
<constraints nullable="false"/>
</column>
<column name="url" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="spalshik (generated)" id="1501263805585-17">
<createTable catalogName="deployer" schemaName="deployer" tableName="routes">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints primaryKey="true"/>
</column>
<column name="apceraInternalAdminRoute" type="VARCHAR(255)"/>
<column name="apceraInternalRoute" type="VARCHAR(255)"/>
<column name="mwRoute" type="VARCHAR(255)"/>
<column name="paasRoute" type="VARCHAR(255)"/>
</createTable>
</changeSet>
<changeSet author="(generated)" id="1501263805585-18">
<createTable catalogName="deployer" schemaName="deployer" tableName="serviceRoutes">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints primaryKey="true"/>
</column>
<column name="name" type="VARCHAR(255)"/>
<column name="port" type="INT">
<constraints nullable="false"/>
</column>
<column name="service_id" type="BIGINT"/>
<column name="serviceRoutes_id" type="BIGINT"/>
</createTable>
</changeSet>
<changeSet author="(generated)" id="1501263805585-19">
<createTable catalogName="deployer" schemaName="deployer" tableName="userRequest">
<column name="userRequest_id" type="BIGINT">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet author="(generated)" id="1501263805585-20">
<createTable catalogName="deployer" schemaName="deployer" tableName="userRequests">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints primaryKey="true"/>
</column>
<column name="authData" type="TINYBLOB"/>
<column name="environment_id" type="BIGINT"/>
<column name="namespace" type="VARCHAR(255)"/>
<column name="requestReceived" type="VARCHAR(255)"/>
<column name="sentFromHost" type="VARCHAR(255)"/>
<column name="userRequestPath" type="VARCHAR(255)"/>
<column name="userRequestStatus" type="INT"/>
</createTable>
</changeSet>
<changeSet author="(generated)" id="1501263805585-21">
<addPrimaryKey catalogName="deployer" columnNames="ServiceRoutes_id, routes_KEY" constraintName="PRIMARY" schemaName="deployer" tableName="ServiceRoutes_routes"/>
</changeSet>
<changeSet author="(generated)" id="1501263805585-22">
<addPrimaryKey catalogName="deployer" columnNames="Service_id, endPoints_KEY" constraintName="PRIMARY" schemaName="deployer" tableName="Service_endPoints"/>
</changeSet>
<changeSet author="(generated)" id="1501263805585-23">
<addPrimaryKey catalogName="deployer" columnNames="userRequest_id" constraintName="PRIMARY" schemaName="deployer" tableName="userRequest"/>
</changeSet>
<changeSet author="(generated)" id="1501263805585-24">
<addForeignKeyConstraint baseColumnNames="service_id" baseTableCatalogName="deployer" baseTableName="serviceRoutes" baseTableSchemaName="deployer" constraintName="FK_3ktuugpv4fggfyewoh2g2ychb" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableCatalogName="deployer" referencedTableName="Service" referencedTableSchemaName="deployer"/>
</changeSet>
<changeSet author="(generated)" id="1501263805585-25">
<addForeignKeyConstraint baseColumnNames="Service_id" baseTableCatalogName="deployer" baseTableName="Service_endPoints" baseTableSchemaName="deployer" constraintName="FK_42dx83vof8wtbh7t0qnqv0o4n" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableCatalogName="deployer" referencedTableName="Service" referencedTableSchemaName="deployer"/>
</changeSet>
<changeSet author="(generated)" id="1501263805585-26">
<addForeignKeyConstraint baseColumnNames="service_id" baseTableCatalogName="deployer" baseTableName="ServiceAppStatus" baseTableSchemaName="deployer" constraintName="FK_5qyc3fk6i1p75c6y6bshgqf4r" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableCatalogName="deployer" referencedTableName="Service" referencedTableSchemaName="deployer"/>
</changeSet>
<changeSet author="(generated)" id="1501263805585-27">
<addForeignKeyConstraint baseColumnNames="userRequest_id" baseTableCatalogName="deployer" baseTableName="UserRequestStatus" baseTableSchemaName="deployer" constraintName="FK_5tjecs7hj3m7us8hsn98trj1h" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableCatalogName="deployer" referencedTableName="userRequests" referencedTableSchemaName="deployer"/>
</changeSet>
<changeSet author="(generated)" id="1501263805585-28">
<addForeignKeyConstraint baseColumnNames="ServiceRoutes_id" baseTableCatalogName="deployer" baseTableName="ServiceRoutes_routes" baseTableSchemaName="deployer" constraintName="FK_9u9qpnbb2n5yqmj94winl2yd5" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableCatalogName="deployer" referencedTableName="serviceRoutes" referencedTableSchemaName="deployer"/>
</changeSet>
<changeSet author="(generated)" id="1501263805585-29">
<addForeignKeyConstraint baseColumnNames="deploy_id" baseTableCatalogName="deployer" baseTableName="DeployStatus" baseTableSchemaName="deployer" constraintName="FK_9x0gysgvns0gdfi092q1qe73j" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableCatalogName="deployer" referencedTableName="deploys" referencedTableSchemaName="deployer"/>
</changeSet>
<changeSet author="(generated)" id="1501263805585-30">
<addForeignKeyConstraint baseColumnNames="networkServiceConfig_id" baseTableCatalogName="deployer" baseTableName="Service" baseTableSchemaName="deployer" constraintName="FK_b63wbyv84yy825er8lt6h6eij" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableCatalogName="deployer" referencedTableName="networkServiceConfig" referencedTableSchemaName="deployer"/>
</changeSet>
<changeSet author="(generated)" id="1501263805585-31">
<addForeignKeyConstraint baseColumnNames="environment_id" baseTableCatalogName="deployer" baseTableName="Service" baseTableSchemaName="deployer" constraintName="FK_hn3ubyorvnaiio8opayvwud88" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableCatalogName="deployer" referencedTableName="ephemeralEnvironments" referencedTableSchemaName="deployer"/>
</changeSet>
<changeSet author="(generated)" id="1501263805585-32">
<addForeignKeyConstraint baseColumnNames="ServiceDeploy_id" baseTableCatalogName="deployer" baseTableName="ServiceDeploy_dependentIds" baseTableSchemaName="deployer" constraintName="FK_imf7a562xiqh41nh0kmfxs22k" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableCatalogName="deployer" referencedTableName="ServiceDeploy" referencedTableSchemaName="deployer"/>
</changeSet>
<changeSet author="(generated)" id="1501263805585-33">
<addForeignKeyConstraint baseColumnNames="Service_id" baseTableCatalogName="deployer" baseTableName="Service_dependentIds" baseTableSchemaName="deployer" constraintName="FK_ncklvx0g74ul9b81kp63qbx1c" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableCatalogName="deployer" referencedTableName="Service" referencedTableSchemaName="deployer"/>
</changeSet>
<changeSet author="(generated)" id="1501263805585-34">
<addForeignKeyConstraint baseColumnNames="deploy_id" baseTableCatalogName="deployer" baseTableName="ServiceDeploy" baseTableSchemaName="deployer" constraintName="FK_qf43uf6tcqqsat39vx9g6uggl" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableCatalogName="deployer" referencedTableName="deploys" referencedTableSchemaName="deployer"/>
</changeSet>
<changeSet author="(generated)" id="1501263805585-35">
<addForeignKeyConstraint baseColumnNames="userRequest_id" baseTableCatalogName="deployer" baseTableName="userRequest" baseTableSchemaName="deployer" constraintName="FK_quovo4p0lawd4rkt2xmwtb44e" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableCatalogName="deployer" referencedTableName="Service" referencedTableSchemaName="deployer"/>
</changeSet>
<changeSet author="(generated)" id="1501263805585-36">
<addForeignKeyConstraint baseColumnNames="serviceRoutes_id" baseTableCatalogName="deployer" baseTableName="serviceRoutes" baseTableSchemaName="deployer" constraintName="FK_quw469h9qpk2pjpyd7nis6jey" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableCatalogName="deployer" referencedTableName="Service" referencedTableSchemaName="deployer"/>
</changeSet>
<changeSet author="(generated)" id="1501263805585-37">
<addForeignKeyConstraint baseColumnNames="environment_id" baseTableCatalogName="deployer" baseTableName="userRequests" baseTableSchemaName="deployer" constraintName="FK_rbe9okb4x1k77xluy1tibohw6" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableCatalogName="deployer" referencedTableName="ephemeralEnvironments" referencedTableSchemaName="deployer"/>
</changeSet>
<changeSet author="(generated)" id="1501263805585-38">
<addForeignKeyConstraint baseColumnNames="userRequest_id" baseTableCatalogName="deployer" baseTableName="Service" baseTableSchemaName="deployer" constraintName="FK_rvx1c6um92vde9so5v3x9pkry" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableCatalogName="deployer" referencedTableName="userRequests" referencedTableSchemaName="deployer"/>
</changeSet>
<changeSet author="(generated)" id="1501263805585-39">
<addForeignKeyConstraint baseColumnNames="serviceDeploy_id" baseTableCatalogName="deployer" baseTableName="ServiceStatus" baseTableSchemaName="deployer" constraintName="FK_tfv2a1us83fj83cgks8ye5eqi" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableCatalogName="deployer" referencedTableName="ServiceDeploy" referencedTableSchemaName="deployer"/>
</changeSet>
</databaseChangeLog>
添加如下所示的先决条件
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="Your_Table_Name"/>
</not>
</preConditions>
如
<changeSet author="(generated)" id="1501263805585-5">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="ServiceDeploy"/>
</not>
</preConditions>
<createTable catalogName="deployer" schemaName="deployer" tableName="ServiceDeploy">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints primaryKey="true"/>
</column>
<column name="artifactId" type="VARCHAR(255)"/>
<column name="deploymentArtifacts" type="VARCHAR(255)"/>
<column name="executionLevel" type="INT"/>
<column name="groupId" type="VARCHAR(255)"/>
<column name="item" type="INT"/>
<column name="serviceTag" type="VARCHAR(255)"/>
<column name="url" type="VARCHAR(255)"/>
<column name="versionId" type="VARCHAR(255)"/>
<column name="deploy_id" type="BIGINT"/>
</createTable>
</changeSet>
出身背景 我正在使用命令行界面对DB2运行flyway迁移。我做了很多测试,一切都很好。我添加了一些命令以导致失败。 问题 有人能确认如果迁移失败并且数据库支持DDL,是否应该回滚更改表、删除表或创建表吗?当我测试它时,它看起来像是在同一个flyway脚本中失败后没有回滚更改表添加列语句。
我正在运行一个Spring boot 2.4.3应用程序,我有一个支持事务的mongob 4集群(我使用run-rs在本地运行它)。我也在使用Spring data mongob。我正在尝试为db迁移集成mongock(最新版本-4.3.8),但我面临一个问题,我无法解决。正如我们所知,最新版本的mongock默认使用事务。我有以下更改集,它只是为我的一个实体创建了一个mongob集合。 运行应用
我想在aws beanstalk中部署geodjango。 我已经尝试过这个解决方案。它以前工作过。 但现在它显示了这个错误。 以下是完整的错误日志
问题内容: 我正在尝试应用迁移,但出现错误: django.db.utils.OperationalError:(1050,“表’customers_customer’已经存在”) 我通过发出以下命令来获取此信息: 我的客户表已经存在,那么该怎么做才能让迁移知道这一点,而不是出错,然后对模型进行修改? 我在本地环境的本地数据库上运行了此文件,没有问题。当我将数据库指向生产环境并在上面运行时,出现此
我使用laravel 5.2版本和PHP 7.1。我试图从我的laravel项目中迁移文件,其中我有代码来检查列的存在,如下所示- 我知道代码非常好,在设置相同的代码时,这已经运行了好几次。但现在我在另一台机器上尝试,失败了,出现了一个错误- [ErrorException] 未定义的属性:stdClass::$column\u name 如果我从代码中删除hasColumn检查,我可以消除这个错
问题内容: 我正在为Oracle数据库编写一些迁移脚本,并希望Oracle具有类似于MySQL的构造。 具体来说,每当我想在MySQL中删除表时,我都会做类似的事情 这样,如果表不存在,则不会产生错误,并且脚本可以继续。 Oracle有类似的机制吗?我意识到我可以使用以下查询来检查表是否存在 但是将其与a捆绑在一起的语法使我逃脱了。 问题答案: 最好和最有效的方法是捕获“找不到表”异常:这样可以避