I have the following tables:
======================= ======================= | galleries | | images | |---------------------| |---------------------| | PK | gallery_id |<--\ | PK | image_id | | | name | \ | | title | | | description | \ | | description | | | max_images | \ | | filename | ======================= \-->| FK | gallery_id | =======================
I need to implement a way in which images associated with a gallery are sorted in a specific order. As I understand it, relational databases are not designed for hierarchical ordering.
I also want to prepare for the concurrency feature, although this is unlikely to be a problem in my current project, as it is a single-user application. (So, the priority here is to allow the user to reorder).
I am not sure if this is the best way since I have never implemented orders in a database and not new to concurrency. Because of this, I read about locking MySQL tables and am not sure if this is a situation where I have to implement it.
Here are my two ideas:
order_num images. , .
order_num
images
order_num images ( 1 ). .
!
: - , . , , , .
, , , , . 1 , , , .. , , , , , 2 , .
: , , , javascript. , , . order_num .
, , - , 1 2 , , , , . , , , .
, , , , . , , , .
, .
, " " order_num . InnoDB , .
: id (auto increment) . . id, parent.
Concurrency: concurrency. . , 1 , , . .
Source: https://habr.com/ru/post/1751324/More articles:How to create a floating panel for iPhone / iPad? - iphoneRails double-sided self-referencing has_many: through - controller configuration? - ruby-on-railsjquery file tree - folder open by default? - jqueryWhat does this "for me in [...]" loop code do? - pythonproblem with two files - c ++In SDL, does SDL_Quit () free every surface? - c ++Database class in PHP; has only one function - a question about practice and whether it is a good idea - phpHow to convert int to byte array and then back? - c #WPF: accessing resources in a control assembly - resourcesWPF element binding element for IsEnabled (but for false) - checkboxAll Articles