Liquibase-如何为现有数据库生成变更日志 [英] Liquibase - how to generate a changelog for existing database

查看:604
本文介绍了Liquibase-如何为现有数据库生成变更日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用liquibase生成changeLog,首先是对数据库的当前状态进行快照.

I'm trying to use liquibase for generating the changeLog, starting by snapshoting the current state of my database.

环境详细信息:

  • 操作系统:Windows 7 32 x86,
  • Java JDK 1.7,
  • MySQL的mysql jdbc驱动程序
  • liquibase 2.0.5.

我从命令行运行以下命令:

I run the following from command line:

liquibase --driver=com.mysql.jdbc.Driver --changeLogFile=./structure.xml --url="jdbc:mysql://mysql.mysite.com" --username=<myuser> --password=<mypass> generateChangeLog

它运行正常,并生成了输出文件.但是输出文件仅包含:

It runs fine, and generated the output file. But the output file just contains:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" 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-2.0.xsd"/>

在我的数据库上没有创建任何表(我期望这两个表用于跟踪).

And no tables are created on my database (I was expecting the two tables used for tracking).

我想念什么?

编辑

是的,我指的是liquibasechanlog和liquibasechangelock表.我知道它们应该自动出现在数据库中.我的问题是为什么他们不在那里.是的,提供的用户拥有执行此任务的权限.

Yes, I'm referring to liquibasechanlog and liquibasechangelock tables. I know they should automatically appears on database. My question is why they aren't there. And yes, the provided user have the rights granted for doing such task.

它不是一个空数据库.它具有近20个表,10个视图,数据...

And it is not an empty database. It has near 20 tables, 10 views, data...

推荐答案

只需使用--url标志指定数据库名称,例如 ZNK 说:

Just specify the database name with the --url flag like ZNK said:

  --url="jdbc:mysql://mysql.mysite.com/database_name_here"

这篇关于Liquibase-如何为现有数据库生成变更日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆