mirror of
https://github.com/Alexander-D-Karpov/webring.git
synced 2026-03-16 22:07:41 +03:00
* fix: Make data API route paths consistent * feat: Implement redirect for current website * feat: Implement slugs and id reordering * feat: Implement slug validation * fix: Add constant zero ID to public site data for compatibility * fix: Make slug length limited when validating * docs: Update routes in README.md * feat: Implement gapless reordering * fix: Add IDs back to public data * feat: Implement ID/slug collision checks
11 lines
384 B
SQL
11 lines
384 B
SQL
ALTER TABLE sites ADD COLUMN slug TEXT UNIQUE;
|
|
UPDATE sites SET slug = id;
|
|
ALTER TABLE sites ALTER COLUMN slug SET NOT NULL;
|
|
|
|
-- Deferred id uniqueness
|
|
ALTER TABLE sites DROP CONSTRAINT sites_pkey;
|
|
ALTER TABLE sites ADD PRIMARY KEY (slug);
|
|
ALTER TABLE sites ADD CONSTRAINT sites_unique_id
|
|
UNIQUE (id) DEFERRABLE INITIALLY DEFERRED;
|
|
ALTER TABLE sites ALTER COLUMN id SET NOT NULL;
|