Skip to content

Commit 7a61eed

Browse files
committed
use ids to order tags, and types of objects and morphisms
1 parent fe84b79 commit 7a61eed

8 files changed

Lines changed: 34 additions & 34 deletions

File tree

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
INSERT INTO tags (position, tag)
1+
INSERT INTO tags (tag)
22
VALUES
3-
(1, 'algebra'),
4-
(2, 'algebraic geometry'),
5-
(3, 'analysis'),
6-
(4, 'category theory'),
7-
(5, 'combinatorics'),
8-
(6, 'number theory'),
9-
(7, 'order theory'),
10-
(8, 'set theory'),
11-
(9, 'topology'),
12-
(10, 'finite'),
13-
(11, 'thin'),
14-
(12, 'single object');
3+
('algebra'),
4+
('algebraic geometry'),
5+
('analysis'),
6+
('category theory'),
7+
('combinatorics'),
8+
('number theory'),
9+
('order theory'),
10+
('set theory'),
11+
('topology'),
12+
('finite'),
13+
('thin'),
14+
('single object');
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
INSERT INTO special_object_types (type, dual, position)
1+
INSERT INTO special_object_types (type, dual)
22
VALUES
3-
('terminal object', 'initial object', 0),
4-
('initial object', 'terminal object', 1),
5-
('products', 'coproducts', 2),
6-
('coproducts', 'products', 3);
3+
('terminal object', 'initial object'),
4+
('initial object', 'terminal object'),
5+
('products', 'coproducts'),
6+
('coproducts', 'products');
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
INSERT INTO special_morphism_types (type, dual, position)
1+
INSERT INTO special_morphism_types (type, dual)
22
VALUES
3-
('isomorphisms', 'isomorphisms', 0),
4-
('monomorphisms', 'epimorphisms', 1),
5-
('epimorphisms', 'monomorphisms', 2),
6-
('regular monomorphisms', 'regular epimorphisms', 3),
7-
('regular epimorphisms', 'regular monomorphisms', 4);
3+
('isomorphisms', 'isomorphisms'),
4+
('monomorphisms', 'epimorphisms'),
5+
('epimorphisms', 'monomorphisms'),
6+
('regular monomorphisms', 'regular epimorphisms'),
7+
('regular epimorphisms', 'regular monomorphisms');

databases/catdat/schema/002_tags.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CREATE TABLE tags (
2-
tag TEXT PRIMARY KEY,
3-
position INTEGER DEFAULT 0
2+
id INTEGER PRIMARY KEY,
3+
tag TEXT NOT NULL UNIQUE
44
);
55

66
CREATE TABLE category_tag_assignments (

databases/catdat/schema/007_special_objects.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CREATE TABLE special_object_types (
2-
type TEXT PRIMARY KEY,
2+
id INTEGER PRIMARY KEY,
3+
type TEXT NOT NULL UNIQUE,
34
dual TEXT,
4-
position INTEGER NOT NULL DEFAULT 0,
55
FOREIGN KEY (dual) REFERENCES special_object_types (type) ON DELETE SET NULL
66
);
77

databases/catdat/schema/008_special-morphisms.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CREATE TABLE special_morphism_types (
2-
type TEXT PRIMARY KEY,
2+
id INTEGER PRIMARY KEY,
3+
type TEXT NOT NULL UNIQUE,
34
dual TEXT,
4-
position INTEGER NOT NULL DEFAULT 0,
55
FOREIGN KEY (dual) REFERENCES special_morphism_types (type) ON DELETE SET NULL
66
);
77

src/routes/categories/+page.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import sql from 'sql-template-tag'
66
export const load = async () => {
77
const { results, err } = batch<[CategoryShort, TagObject]>([
88
sql`SELECT id, name FROM categories ORDER BY lower(name)`,
9-
sql`SELECT tag FROM tags ORDER BY position`,
9+
sql`SELECT tag FROM tags ORDER BY id`,
1010
])
1111

1212
if (err) error(500, 'Categories could not be loaded')

src/routes/category/[id]/+page.server.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const load = async (event) => {
6565
FROM category_tag_assignments ct
6666
INNER JOIN tags t ON t.tag = ct.tag
6767
WHERE ct.category_id = ${id}
68-
ORDER BY t.position
68+
ORDER BY t.id
6969
`,
7070
// properties
7171
sql`
@@ -105,15 +105,15 @@ export const load = async (event) => {
105105
FROM special_objects s
106106
INNER JOIN special_object_types t ON t.type = s.type
107107
WHERE s.category_id = ${id}
108-
ORDER BY t.position
108+
ORDER BY t.id
109109
`,
110110
// special morphisms
111111
sql`
112112
SELECT t.type, s.description, s.reason
113113
FROM special_morphism_types t
114114
LEFT JOIN special_morphisms s
115115
ON s.type = t.type AND s.category_id = ${id}
116-
ORDER BY t.position
116+
ORDER BY t.id
117117
`,
118118
// undistinguishable categories
119119
sql`

0 commit comments

Comments
 (0)