Question: I am currently setting up a project that is based on Python Flask (with Flask Migrate) with a PostgreSQL DB. I am working in a small team and have some questions regarding database updates.

As far as I am aware, If I update the database schema in Flask, I will have to perform a `flask db migrate` and `flask db upgrade` to apply the changes. And others that receives my update executes a `flask db upgrade` to receive the schema changes. All is well but if I have updated rows in the database, how do I propagate the schema changes and data changes to my peers?

If I `migrate and upgrade` my flask database followed by exporting a dump with `psql`, when my peers receive the updates, do they simply import the data dump? Or do they have to perform a `flask db upgrade` as well? If so, which one comes first? `flask db upgrade` followed by dump import, or dump import followed by a `flask db upgrade`?

I am not sure if simply importing the data dump with updated schema will mess up the migration commits in Flask Migrate. Not sure if this is the right place to ask but I hope I am able to find some answers here.
Thanks in advance!

Edit: So far I am updating data in the database by dropping the database and recreating it with the dump, but I have yet to try it with any schema changes (project is progressing, a little slowly..)

Edit 2: Forgot to mention that all instances of PostgreSQL are hosted locally on our own machines

Answer: 
To understand your error, you have to know what strings are.

Strings in java are arrays of char:

```
char[] example = {'H', 'E', 'L', 'L', 'O');

```

You can manipulate strings in a similar why to arrays. Arrays first index is 0 and max Index length - 1

Let now assume the above example is an instance of String and you do:

```
example.subString (0, 3) // Return value would be "HEL". 

example.subString (0, 10) // StringIndexOutOfBoundsException

```

To prevent this, you have to use whats ever come first. Your cap at 17 or the cap defined by the length of the string.

```
example.subString (0, Math.min(17, example.length()));

```

While there is no built in function in Thymeleaf, you can use the special T(...) operator to call static methods (allowing you to use Java's Math.max(...) in your Thymeleaf).

```
<div th:with="maxNumber=${T(Math).min(8,12)}">
   <p th:text=${maxNumber}></p>
</div>

```

---

As mentioned in the comments, there is a more Thymeleaf special method to approach your goal:

[I want to abbreviate a string with Thymeleaf](https://stackoverflow.com/questions/49897473/i-want-to-abbreviate-a-string-with-thymeleaf)
You can also use a condition to take care of out of bounds e.g.

```
    <span th:if="${post.content.length()>17}">
    <span th:utext="${#strings.substring(post.content,0,17)}"></span>
    </span>
    <span th:if="${post.content.length()<17}">
    <span th:utext="${#strings.substring(post.content,0,post.content.length())}"></span>
    </span>

```