File tree 3 files changed +50
-4
lines changed
3 files changed +50
-4
lines changed Original file line number Diff line number Diff line change 35
35
<include file =" 0.4/2017-11-08--import_series.xml" relativeToChangelogFile =" true" />
36
36
<include file =" 0.4/2017-11-09--series_import_requests_url_length.xml" relativeToChangelogFile =" true" />
37
37
<include file =" 0.4/2017-11-09--series_import_parsed_data_release_year_field.xml" relativeToChangelogFile =" true" />
38
+ <include file =" 0.4/2017-11-09--categories_aliases.xml" relativeToChangelogFile =" true" />
38
39
39
40
</databaseChangeLog >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <databaseChangeLog
3
+ xmlns=" http://www.liquibase.org/xml/ns/dbchangelog"
4
+ xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
5
+ xsi:schemaLocation=" http://www.liquibase.org/xml/ns/dbchangelog
6
+ http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd" >
7
+
8
+ <changeSet id =" create-categories_aliases-table" author =" php-coder" context =" scheme" >
9
+
10
+ <createTable tableName =" categories_aliases" >
11
+ <column name =" category_id" type =" INTEGER" >
12
+ <constraints
13
+ nullable=" false"
14
+ references=" categories(id)"
15
+ foreignKeyName=" fk_categories_aliases_category_id" />
16
+ </column >
17
+ <column name =" name" type =" VARCHAR(50)" >
18
+ <constraints
19
+ unique=" true"
20
+ uniqueConstraintName=" uc_categories_aliases_name" />
21
+ </column >
22
+ <column name =" name_ru" type =" VARCHAR(50)" >
23
+ <constraints
24
+ unique=" true"
25
+ uniqueConstraintName=" uc_categories_aliases_name_ru" />
26
+ </column >
27
+ </createTable >
28
+
29
+ </changeSet >
30
+
31
+ <changeSet id =" add-dinosaurs-alias" author =" php-coder" context =" test-data" >
32
+
33
+ <insert tableName =" categories_aliases" >
34
+ <column name =" category_id" valueNumeric =" 1" />
35
+ <column name =" name" value =" Dinosaurs" />
36
+ <column name =" name_ru" value =" Динозавры" />
37
+ </insert >
38
+
39
+ </changeSet >
40
+
41
+ </databaseChangeLog >
Original file line number Diff line number Diff line change @@ -68,10 +68,14 @@ category.count_stamps_by_categories = \
68
68
GROUP BY s.category_id
69
69
70
70
category.find_ids_by_names = \
71
- SELECT id \
72
- FROM categories \
73
- WHERE name IN (:names) \
74
- OR name_ru IN (:names)
71
+ SELECT c.id \
72
+ FROM categories c \
73
+ LEFT JOIN categories_aliases ca \
74
+ ON ca.category_id = c.id \
75
+ WHERE c.name IN (:names) \
76
+ OR c.name_ru IN (:names) \
77
+ OR ca.name IN (:names) \
78
+ OR ca.name_ru IN (:names)
75
79
76
80
category.find_ids_by_name_pattern = \
77
81
SELECT id \
You can’t perform that action at this time.
0 commit comments