第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如果表存在則跳過(guò) liquibase 更改

如果表存在則跳過(guò) liquibase 更改

GCT1015 2023-06-14 14:32:03
liquibase 的新手。我有一個(gè)由休眠管理的現(xiàn)有架構(gòu)。我現(xiàn)在需要?jiǎng)h除一些表,我正在使用 liquibase。我寫了一個(gè)成功刪除表的配置。但我希望檢查僅在表存在時(shí)運(yùn)行,因?yàn)樾掳惭b的系統(tǒng)不會(huì)有表,因?yàn)樾菝哂成鋵?duì)象不再存在。我試圖添加一個(gè)先決條件。但是,我的日志仍然表明 liquibase 失敗,因?yàn)樗噲D刪除該表但它不存在。我做錯(cuò)了什么?我正在使用 Spring Boot / JavadatabaseChangeLog:  - preConditions:      on-fail: mark_ran      on-error: mark_ran      tableExists:        tableName: some_old_table        schemaName: public  - changeSet:      id: 01_del_old_table      author: some-dev-01      comment: Remove old table      changes:        - dropTable:            tableName: some_old_table日志中的錯(cuò)誤:表 public.some_old_table 不存在 ...PreconditionFailedException這就像 ti 正在檢查先決條件……但仍然沒(méi)有通過(guò)。也試過(guò)databaseChangeLog:  - changeSet:      id: zzchange-1.0-remove-xczczxc      author: zzzz      comment: Remove some_old_table table - no longer needed      preConditions:        on-fail: mark_ran        tableExists:          tableName: some_old_table      changes:        - dropTable:            tableName: some_old_table
查看完整描述

3 回答

?
收到一只叮咚

TA貢獻(xiàn)1821條經(jīng)驗(yàn) 獲得超5個(gè)贊

問(wèn)題在于on-fail屬性拼寫不正確。on-fail應(yīng)該是onFail。

最好將先決條件置于特定更改集的范圍內(nèi),并且注釋應(yīng)該在先決條件之后進(jìn)行,盡管這不是這里的問(wèn)題。


databaseChangeLog:

? - changeSet:

? ? ? id: zzchange-1.0-remove-xczczxc

? ? ? author: zzzz

? ? ? preConditions:

? ? ? ? onFail: mark_ran

? ? ? ? tableExists:

? ? ? ? ? tableName: some_old_table

? ? ? comment: Remove some_old_table table - no longer needed

? ? ? changes:

? ? ? ? - dropTable:

? ? ? ? ? ? tableName: some_old_table


查看完整回答
反對(duì) 回復(fù) 2023-06-14
?
心有法竹

TA貢獻(xiàn)1866條經(jīng)驗(yàn) 獲得超5個(gè)贊

在你的第二次嘗試中,在你的先決條件之后發(fā)表你的評(píng)論


databaseChangeLog:

? - changeSet:

? ? ? id: zzchange-1.0-remove-xczczxc

? ? ? author: zzzz

? ? ? preConditions:

? ? ? ? on-fail: mark_ran

? ? ? ? tableExists:

? ? ? ? ? tableName: some_old_table

? ? ? comment: Remove some_old_table table - no longer needed

? ? ? changes:

? ? ? ? - dropTable:

? ? ? ? ? ? tableName: some_old_table


我不太確定為什么您的第一次嘗試行不通,但是我認(rèn)為擁有全局先決條件不是一個(gè)好主意。這是因?yàn)樗麄冊(cè)谕晃臋n中所說(shuō)的:


Preconditions at the changelog level apply to all changesets, not just those listed in the current changelog or its child changelogs.



查看完整回答
反對(duì) 回復(fù) 2023-06-14
?
嗶嗶one

TA貢獻(xiàn)1854條經(jīng)驗(yàn) 獲得超8個(gè)贊

請(qǐng)使用以下語(yǔ)法跳過(guò)當(dāng)前表中的更改

CREATE table IF NOT EXISTS


查看完整回答
反對(duì) 回復(fù) 2023-06-14
  • 3 回答
  • 0 關(guān)注
  • 385 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)