Add localized texts to Benki post model.
Change-Id: I123cfe2ff06f85dc14c705b21d723d1c68fd2e00
diff --git a/src/main/resources/META-INF/resources/bookmarks/MlkBookmarkSubmissionForm.js b/src/main/resources/META-INF/resources/bookmarks/MlkBookmarkSubmissionForm.js
index 6ecc355..b4d21d3 100644
--- a/src/main/resources/META-INF/resources/bookmarks/MlkBookmarkSubmissionForm.js
+++ b/src/main/resources/META-INF/resources/bookmarks/MlkBookmarkSubmissionForm.js
@@ -173,9 +173,11 @@
let post = await r.json();
this.uriInput.value = post.uri;
- this.titleInput.value = post.title;
- this.descriptionInput.innerText = post.description;
this.visibilityInput.value = post.visibility;
+ if (post.texts['']) {
+ this.titleInput.value = post.texts[''].title;
+ this.descriptionInput.innerText = post.texts[''].description;
+ }
this.loaded = true;
}
diff --git a/src/main/resources/META-INF/resources/lazychat/MlkLazychatSubmissionForm.js b/src/main/resources/META-INF/resources/lazychat/MlkLazychatSubmissionForm.js
index c6334ad..3688527 100644
--- a/src/main/resources/META-INF/resources/lazychat/MlkLazychatSubmissionForm.js
+++ b/src/main/resources/META-INF/resources/lazychat/MlkLazychatSubmissionForm.js
@@ -107,8 +107,10 @@
}
let post = await r.json();
- this.textInput.value = post.content;
this.visibilityInput.value = post.visibility;
+ if (post.texts['']) {
+ this.textInput.value = post.texts[''].content;
+ }
this.loaded = true;
}
diff --git a/src/main/resources/db/changeLog-1.2.xml b/src/main/resources/db/changeLog-1.2.xml
new file mode 100644
index 0000000..87ff426
--- /dev/null
+++ b/src/main/resources/db/changeLog-1.2.xml
@@ -0,0 +1,15 @@
+<?xml version="1.1" 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-3.10.xsd">
+
+ <changeSet author="mulk" id="1.2-1">
+ <dropColumn tableName="lazychat_messages" schemaName="benki">
+ <column name="format"/>
+ </dropColumn>
+ </changeSet>
+
+</databaseChangeLog>
diff --git a/src/main/resources/db/changeLog-1.3.xml b/src/main/resources/db/changeLog-1.3.xml
new file mode 100644
index 0000000..a0659c0
--- /dev/null
+++ b/src/main/resources/db/changeLog-1.3.xml
@@ -0,0 +1,79 @@
+<?xml version="1.1" 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-3.10.xsd">
+
+ <changeSet author="mulk" id="1.3-1">
+ <createTable tableName="lazychat_message_texts" schemaName="benki">
+ <column name="lazychat_message" type="integer">
+ <constraints
+ nullable="false"
+ primaryKeyName="lazychat_message_texts_pkey"
+ primaryKey="true"
+ foreignKeyName="lazychat_message_texts_lazychat_message_fkey"
+ referencedTableSchemaName="benki"
+ referencedTableName="lazychat_messages"
+ referencedColumnNames="id"/>
+ </column>
+
+ <column name="language" type="varchar">
+ <constraints
+ nullable="false"
+ primaryKeyName="lazychat_message_texts_pkey"
+ primaryKey="true"
+ checkConstraint="IN ('', 'de', 'en', 'fr', 'ja', 'la')"/>
+ </column>
+
+ <column name="content" type="varchar">
+ <constraints nullable="false"/>
+ </column>
+ </createTable>
+
+ <sql>
+ insert into benki.lazychat_message_texts(lazychat_message, language, content)
+ select id, '', content from benki.lazychat_messages;
+ </sql>
+
+ <dropColumn tableName="lazychat_messages" schemaName="benki">
+ <column name="content"/>
+ </dropColumn>
+
+ <createTable tableName="bookmark_texts" schemaName="benki">
+ <column name="bookmark" type="integer">
+ <constraints
+ nullable="false"
+ primaryKeyName="bookmark_texts_pkey"
+ primaryKey="true"
+ foreignKeyName="bookmark_texts_bookmark_fkey"
+ referencedTableSchemaName="benki"
+ referencedTableName="bookmarks"
+ referencedColumnNames="id"/>
+ </column>
+
+ <column name="language" type="varchar">
+ <constraints
+ nullable="false"
+ primaryKeyName="bookmark_texts_pkey"
+ primaryKey="true"
+ checkConstraint="IN ('', 'de', 'en', 'fr', 'ja', 'la')"/>
+ </column>
+
+ <column name="title" type="varchar"/>
+ <column name="description" type="varchar"/>
+ </createTable>
+
+ <sql>
+ insert into benki.bookmark_texts(bookmark, language, title, description)
+ select id, '', title, description from benki.bookmarks;
+ </sql>
+
+ <dropColumn tableName="bookmarks" schemaName="benki">
+ <column name="title"/>
+ <column name="description"/>
+ </dropColumn>
+ </changeSet>
+
+</databaseChangeLog>
diff --git a/src/main/resources/db/changeLog-1.4.xml b/src/main/resources/db/changeLog-1.4.xml
new file mode 100644
index 0000000..2e47dab
--- /dev/null
+++ b/src/main/resources/db/changeLog-1.4.xml
@@ -0,0 +1,43 @@
+<?xml version="1.1" 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-3.10.xsd">
+
+ <changeSet author="mulk" id="1.3-1">
+ <createTable tableName="post_texts" schemaName="benki">
+ <column name="post" type="integer">
+ <constraints
+ nullable="false"
+ primaryKeyName="post_texts_pkey"
+ primaryKey="true"
+ foreignKeyName="post_texts_post_fkey"
+ referencedTableSchemaName="benki"
+ referencedTableName="posts"
+ referencedColumnNames="id"/>
+ </column>
+
+ <column name="language" type="varchar">
+ <constraints
+ nullable="false"
+ primaryKeyName="lazychat_message_texts_pkey"
+ primaryKey="true"
+ checkConstraint="IN ('', 'de', 'en', 'fr', 'ja', 'la')"/>
+ </column>
+ </createTable>
+
+ <renameColumn tableName="lazychat_message_texts" schemaName="benki" oldColumnName="lazychat_message" newColumnName="post"/>
+ <renameColumn tableName="bookmark_texts" schemaName="benki" oldColumnName="bookmark" newColumnName="post"/>
+
+ <sql>
+ ALTER TABLE benki.lazychat_message_texts INHERIT benki.post_texts;
+ </sql>
+
+ <sql>
+ ALTER TABLE benki.bookmark_texts INHERIT benki.post_texts;
+ </sql>
+ </changeSet>
+
+</databaseChangeLog>
diff --git a/src/main/resources/db/changeLog-1.5.xml b/src/main/resources/db/changeLog-1.5.xml
new file mode 100644
index 0000000..c10beb1
--- /dev/null
+++ b/src/main/resources/db/changeLog-1.5.xml
@@ -0,0 +1,41 @@
+<?xml version="1.1" 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-3.10.xsd">
+
+ <changeSet author="mulk" id="1.3-1">
+ <addColumn tableName="bookmark_texts" schemaName="benki">
+ <column name="cached_description_html" type="VARCHAR"/>
+ <column name="cached_description_version" type="INTEGER"/>
+ </addColumn>
+
+ <addColumn tableName="lazychat_message_texts" schemaName="benki">
+ <column name="cached_description_html" type="VARCHAR"/>
+ <column name="cached_description_version" type="INTEGER"/>
+ </addColumn>
+
+ <addColumn tableName="post_texts" schemaName="benki">
+ <column name="cached_description_html" type="VARCHAR"/>
+ <column name="cached_description_version" type="INTEGER"/>
+ </addColumn>
+
+ <dropColumn tableName="posts" schemaName="benki">
+ <column name="cached_description_html"/>
+ <column name="cached_description_version"/>
+ </dropColumn>
+
+ <dropColumn tableName="bookmarks" schemaName="benki">
+ <column name="cached_description_html"/>
+ <column name="cached_description_version"/>
+ </dropColumn>
+
+ <dropColumn tableName="lazychat_messages" schemaName="benki">
+ <column name="cached_description_html"/>
+ <column name="cached_description_version"/>
+ </dropColumn>
+ </changeSet>
+
+</databaseChangeLog>
diff --git a/src/main/resources/db/changeLog.xml b/src/main/resources/db/changeLog.xml
index 7d346aa..1c5c4ea 100644
--- a/src/main/resources/db/changeLog.xml
+++ b/src/main/resources/db/changeLog.xml
@@ -8,5 +8,9 @@
<include file="db/changeLog-1.0.xml"/>
<include file="db/changeLog-1.1.xml"/>
+ <include file="db/changeLog-1.2.xml"/>
+ <include file="db/changeLog-1.3.xml"/>
+ <include file="db/changeLog-1.4.xml"/>
+ <include file="db/changeLog-1.5.xml"/>
</databaseChangeLog>
diff --git a/src/main/resources/db/liquibase.properties b/src/main/resources/db/liquibase.properties
index 79aca15..38e258c 100644
--- a/src/main/resources/db/liquibase.properties
+++ b/src/main/resources/db/liquibase.properties
@@ -1,3 +1,3 @@
-url = jdbc:postgresql:///mulkcms?currentSchemas=public,benki
+url = jdbc:postgresql://localhost:5432/mulkcms?currentSchemas=public,benki
changeLogFile = src/main/resources/db/changeLog.xml
schemas = public,benki