Add ajax file upload and markdown convertsion

It's better to use `t.reference` instead of `integer` for definition of foreign keys in migrations.

Also it's good idea to add indexes for foreign keys.