Add language identifiers
This commit is contained in:
parent
881dc5e40a
commit
246a954320
2
migrations/2019-08-15-123406_identifiers/down.sql
Normal file
2
migrations/2019-08-15-123406_identifiers/down.sql
Normal file
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE languages DROP COLUMN identifier;
|
||||
ALTER TABLE wrappers DROP COLUMN identifier;
|
44
migrations/2019-08-15-123406_identifiers/up.sql
Normal file
44
migrations/2019-08-15-123406_identifiers/up.sql
Normal file
|
@ -0,0 +1,44 @@
|
|||
ALTER TABLE languages ADD COLUMN identifier text;
|
||||
|
||||
UPDATE languages SET identifier = CASE name
|
||||
WHEN 'Plain text' THEN 'plain-text'
|
||||
WHEN 'C' THEN 'c'
|
||||
WHEN 'C++' THEN 'c-plus-plus'
|
||||
WHEN 'C#' THEN 'c-sharp'
|
||||
WHEN 'Haskell' THEN 'haskell'
|
||||
WHEN 'HTML' THEN 'html'
|
||||
WHEN 'Java' THEN 'java'
|
||||
WHEN 'JavaScript' THEN 'javascript'
|
||||
WHEN 'Jinja2' THEN 'jinja2'
|
||||
WHEN 'JSX' THEN 'jsx'
|
||||
WHEN 'Markdown' THEN 'markdown'
|
||||
WHEN 'Perl' THEN 'perl'
|
||||
WHEN 'Perl 6' THEN 'perl6'
|
||||
WHEN 'PHP' THEN 'php'
|
||||
WHEN 'PostgreSQL' THEN 'postgresql'
|
||||
WHEN 'Python 2' THEN 'python2'
|
||||
WHEN 'Python 3' THEN 'python3'
|
||||
WHEN 'Rust' THEN 'rust'
|
||||
WHEN 'Sh' THEN 'sh'
|
||||
WHEN 'SQL' THEN 'sql'
|
||||
WHEN 'SQLite' THEN 'sqlite'
|
||||
WHEN 'TypeScript' THEN 'typescript'
|
||||
WHEN 'TypeScript-JSX' THEN 'typescript-jsx'
|
||||
END;
|
||||
|
||||
CREATE INDEX ON languages (identifier);
|
||||
|
||||
ALTER TABLE languages ALTER COLUMN identifier SET NOT NULL;
|
||||
|
||||
ALTER TABLE wrappers ADD COLUMN identifier text;
|
||||
|
||||
UPDATE wrappers SET identifier = CASE label
|
||||
WHEN 'Run' THEN 'run'
|
||||
WHEN 'Format (black)' THEN 'format'
|
||||
WHEN 'Rustfmt' THEN 'format'
|
||||
WHEN 'ASM' THEN 'asm'
|
||||
END;
|
||||
|
||||
ALTER TABLE wrappers ALTER COLUMN identifier SET NOT NULL;
|
||||
|
||||
CREATE INDEX ON wrappers (identifier);
|
|
@ -6,6 +6,7 @@ table! {
|
|||
highlighter_mode -> Nullable<Text>,
|
||||
mime -> Text,
|
||||
is_markdown -> Bool,
|
||||
identifier -> Text,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,6 +30,7 @@ table! {
|
|||
ordering -> Int4,
|
||||
is_formatter -> Bool,
|
||||
is_asm -> Bool,
|
||||
identifier -> Text,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user