mirror of
https://github.com/iv-org/invidious.git
synced 2025-01-03 21:51:45 +05:30
Add new enum
This commit is contained in:
parent
a33c01bd53
commit
22455bbf9e
@ -3,7 +3,7 @@ module Invidious::Database::Migrations
|
|||||||
version 11
|
version 11
|
||||||
|
|
||||||
def up(conn : DB::Connection)
|
def up(conn : DB::Connection)
|
||||||
if !privacy_type_exists?(conn)
|
if !compilation_privacy_type_exists?(conn)
|
||||||
conn.exec <<-SQL
|
conn.exec <<-SQL
|
||||||
CREATE TYPE public.compilation_privacy AS ENUM
|
CREATE TYPE public.compilation_privacy AS ENUM
|
||||||
(
|
(
|
||||||
@ -36,13 +36,13 @@ module Invidious::Database::Migrations
|
|||||||
SQL
|
SQL
|
||||||
end
|
end
|
||||||
|
|
||||||
private def privacy_type_exists?(conn : DB::Connection) : Bool
|
private def compilation_privacy_type_exists?(conn : DB::Connection) : Bool
|
||||||
request = <<-SQL
|
request = <<-SQL
|
||||||
SELECT 1 AS one
|
SELECT 1 AS one
|
||||||
FROM pg_type
|
FROM pg_type
|
||||||
INNER JOIN pg_namespace ON pg_namespace.oid = pg_type.typnamespace
|
INNER JOIN pg_namespace ON pg_namespace.oid = pg_type.typnamespace
|
||||||
WHERE pg_namespace.nspname = 'public'
|
WHERE pg_namespace.nspname = 'public'
|
||||||
AND pg_type.typname = 'privacy'
|
AND pg_type.typname = 'compilation_privacy'
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user