Display map->hint on the website

Bug #1542449 reported by kaputtnik
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Widelands Website
Fix Released
Wishlist
kaputtnik

Bug Description

Newer maps have the tag "hint = " in the elemental file. To use it on the website we could either

1. Create a new filed in the databse for this
or
2. Add the "hint" info to the field "map.descr" and perform some syntax to it.

First choice is the best but i don't know how it works with mysql. On my local installation i have done add a new field to the sqlite database table wlmap_map without problems. On the server it may need some offline time.

Adding the info to the descr filed is also not problematic (choice 2). What i do not know: The desrc field is of type TextField which is described as "A large text field" but i couldn't get a info how large it could be at maximum... See https://docs.djangoproject.com/en/1.4/ref/models/fields/#textfield (also fo mysql related limitations)

Currently i have implemented the second choice.

What do you mean?

Related branches

Revision history for this message
SirVer (sirver) wrote :

As discussed in our skype call earlier, the better solution is adding a field to the database - it is more work now, but less spaghetti later. It is my understanding that this can be run while the site is running as long as a default value is set for that field.

As we found out on the call today when investigating the database, TextField seems to translate to mysql longtext which according to [1] can hold a GBs worth of data.

[1] http://stackoverflow.com/questions/4294506/maximum-length-for-longtext-field

Changed in widelands-website:
status: New → Confirmed
importance: Undecided → Wishlist
assignee: nobody → kaputtnik (franku)
Revision history for this message
kaputtnik (franku) wrote :

A default value couldn't be set for LONGTEXT, see http://dev.mysql.com/doc/refman/5.5/en/blob.html

> BLOB and TEXT columns cannot have DEFAULT values.

So the command should be:

ALTER TABLE wlmaps_map ADD COLUMN hint LONGTEXT;

I am not sure if there should be a NOT NULL at the end. On sqlite it is not possible. With the above command (with sqlite and changing LONGTEXT into TEXT) the table gets a new column. The command

> ./manage.py sql wlmaps

shows the new column only after the model of wlmaps contains the new field and is deployed. But it is not needed to restart the server, i believe...

Assuming sqlite and mysql isn't such a great difference regarding django, we should

1. Add the new column to the database and table wlmaps_map
2. Deploy the changes to model wlmaps

I create a branch soon with some changes containing the changed model of wlmaps. We could test this then with the alpha site.

Just writing this because i fear doing something wrong :-D

Another question: Can i install editor nano on the server? Learning vim is quite hard if one has to learn much more...

Revision history for this message
SirVer (sirver) wrote :

all sounds good to me. You can try that out on the alpha database first and see if if works. I am not a specialist though of course.

And feel free to install nano on the server. As well as anything else you need, except for x11 or something that opens network ports towards the internet. Then, I would like to be informed :)

Revision history for this message
kaputtnik (franku) wrote :

Branch is merged but not deployed on the server because of permission troubles.

GunChleoc (gunchleoc)
Changed in widelands-website:
status: Confirmed → Fix Committed
kaputtnik (franku)
Changed in widelands-website:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.