LoginSignup
0
0

More than 5 years have passed since last update.

【メモ】Dropwizardのmigrationでカラムにcharasetを指定する

Posted at

概要

createtable時にcharasetを指定するには?

migrationファイル

SQLタグでALTER TABLE文を書いてあげる

元ネタのstackoverflow
Liquibase: How to set Charset UTF-8 on MySQL database tables?

<?xml version="1.0" encoding="UTF-8"?>
<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-3.0.xsd">
    <changeSet id="1" author="y.hoge">
        <createTable tableName="hoges">
            <column name="id" type="int(11)" autoIncrement="true">
                <constraints primaryKey="true" nullable="false" />
            </column>
            <column name="message_text" type="text">
                <constraints nullable="false" />
            </column>
        </createTable>
        <sql>ALTER TABLE hoges MODIFY hoge_text text CHARACTER SET utf8
            COLLATE utf8_unicode_ci;
        </sql>
    </changeSet>
</databaseChangeLog>

なんだかなぁ

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0