Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions databases/catdat/data/000_setup/002_tags.sql
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
INSERT INTO tags (position, tag)
INSERT INTO tags (tag)
VALUES
(1, 'algebra'),
(2, 'algebraic geometry'),
(3, 'analysis'),
(4, 'category theory'),
(5, 'combinatorics'),
(6, 'number theory'),
(7, 'order theory'),
(8, 'set theory'),
(9, 'topology'),
(10, 'finite'),
(11, 'thin'),
(12, 'single object');
('algebra'),
('algebraic geometry'),
('analysis'),
('category theory'),
('combinatorics'),
('number theory'),
('order theory'),
('set theory'),
('topology'),
('finite'),
('thin'),
('single object');
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
INSERT INTO special_object_types (type, dual, position)
INSERT INTO special_object_types (type, dual)
VALUES
('terminal object', 'initial object', 0),
('initial object', 'terminal object', 1),
('products', 'coproducts', 2),
('coproducts', 'products', 3);
('terminal object', 'initial object'),
('initial object', 'terminal object'),
('products', 'coproducts'),
('coproducts', 'products');
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
INSERT INTO special_morphism_types (type, dual, position)
INSERT INTO special_morphism_types (type, dual)
VALUES
('isomorphisms', 'isomorphisms', 0),
('monomorphisms', 'epimorphisms', 1),
('epimorphisms', 'monomorphisms', 2),
('regular monomorphisms', 'regular epimorphisms', 3),
('regular epimorphisms', 'regular monomorphisms', 4);
('isomorphisms', 'isomorphisms'),
('monomorphisms', 'epimorphisms'),
('epimorphisms', 'monomorphisms'),
('regular monomorphisms', 'regular epimorphisms'),
('regular epimorphisms', 'regular monomorphisms');
4 changes: 2 additions & 2 deletions databases/catdat/schema/002_tags.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CREATE TABLE tags (
tag TEXT PRIMARY KEY,
position INTEGER DEFAULT 0
id INTEGER PRIMARY KEY,
tag TEXT NOT NULL UNIQUE
);

CREATE TABLE category_tag_assignments (
Expand Down
4 changes: 2 additions & 2 deletions databases/catdat/schema/007_special_objects.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CREATE TABLE special_object_types (
type TEXT PRIMARY KEY,
id INTEGER PRIMARY KEY,
type TEXT NOT NULL UNIQUE,
dual TEXT,
position INTEGER NOT NULL DEFAULT 0,
FOREIGN KEY (dual) REFERENCES special_object_types (type) ON DELETE SET NULL
);

Expand Down
4 changes: 2 additions & 2 deletions databases/catdat/schema/008_special-morphisms.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CREATE TABLE special_morphism_types (
type TEXT PRIMARY KEY,
id INTEGER PRIMARY KEY,
type TEXT NOT NULL UNIQUE,
dual TEXT,
position INTEGER NOT NULL DEFAULT 0,
FOREIGN KEY (dual) REFERENCES special_morphism_types (type) ON DELETE SET NULL
);

Expand Down
2 changes: 1 addition & 1 deletion src/routes/categories/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import sql from 'sql-template-tag'
export const load = async () => {
const { results, err } = batch<[CategoryShort, TagObject]>([
sql`SELECT id, name FROM categories ORDER BY lower(name)`,
sql`SELECT tag FROM tags ORDER BY position`,
sql`SELECT tag FROM tags ORDER BY id`,
])

if (err) error(500, 'Categories could not be loaded')
Expand Down
6 changes: 3 additions & 3 deletions src/routes/category/[id]/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const load = async (event) => {
FROM category_tag_assignments ct
INNER JOIN tags t ON t.tag = ct.tag
WHERE ct.category_id = ${id}
ORDER BY t.position
ORDER BY t.id
`,
// properties
sql`
Expand Down Expand Up @@ -105,15 +105,15 @@ export const load = async (event) => {
FROM special_objects s
INNER JOIN special_object_types t ON t.type = s.type
WHERE s.category_id = ${id}
ORDER BY t.position
ORDER BY t.id
`,
// special morphisms
sql`
SELECT t.type, s.description, s.reason
FROM special_morphism_types t
LEFT JOIN special_morphisms s
ON s.type = t.type AND s.category_id = ${id}
ORDER BY t.position
ORDER BY t.id
`,
// undistinguishable categories
sql`
Expand Down