Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
Merge branch 'search-test' of http://www.github.com/modrinth/labrinth
Browse files Browse the repository at this point in the history
…into search-test
  • Loading branch information
thesuzerain committed Oct 16, 2023
2 parents 340d69f + 96f8e78 commit e3c207f
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions migrations/20231005230721_dynamic-fields.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
CREATE TABLE loader_fields (
id serial PRIMARY KEY,
loader_id integer REFERENCES loaders ON UPDATE CASCADE NOT NULL,
field varchar(64) NOT NULL,
field_type varchar(64) NOT NULL,
enum_type integer REFERENCES loader_field_enums ON UPDATE CASCADE NULL,
optional BOOLEAN NOT NULL DEFAULT true,
-- for int- min/max val, for text- min len, for enum- min items, for bool- nth
min_val integer NULL,
max_val integer NULL
);

CREATE TABLE loader_field_enums (
id serial PRIMARY KEY,
enum_name varchar(64) NOT NULL,
ordering int NULL,
hidable BOOLEAN NOT NULL DEFAULT FALSE,
metadata
);

ALTER TABLE loaders ADD COLUMN hidable boolean NOT NULL default false;

CREATE TABLE version_fields (
id serial PRIMARY KEY,
version_id bigint REFERENCES versions ON UPDATE CASCADE NOT NULL,
field_id integer REFERENCES loader_fields ON UPDATE CASCADE NOT NULL,
-- for int/bool values
int_value integer NULL,
enum_value integer REFERENCES loader_field_enums ON UPDATE CASCADE NULL,
string_value text NULL
);

0 comments on commit e3c207f

Please sign in to comment.