Advertisement
A248

LibertyBans' applicable tables

Dec 10th, 2022
1,117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 2.51 KB | None | 0 0
  1. CREATE VIEW "libertybans_applicable_bans" AS
  2.   SELECT "puns"."id", "puns"."type", "puns"."victim_type", "puns"."victim_uuid", "puns"."victim_address", "puns"."operator",
  3.     "puns"."reason", "puns"."scope", "puns"."start", "puns"."end", "addrs"."uuid", "addrs"."address"
  4.   FROM "libertybans_simple_bans" AS "puns"
  5.   INNER JOIN "libertybans_addresses" AS "addrs"
  6.   ON ("puns"."victim_type" = 0 AND "puns"."victim_uuid" = "addrs"."uuid"
  7.     OR "puns"."victim_type" = 1 AND "puns"."victim_address" = "addrs"."address"
  8.     OR "puns"."victim_type" = 2 AND ("puns"."victim_uuid" = "addrs"."uuid" OR "puns"."victim_address" = "addrs"."address"));
  9.  
  10. CREATE VIEW "libertybans_applicable_mutes" AS
  11.   SELECT "puns"."id", "puns"."type", "puns"."victim_type", "puns"."victim_uuid", "puns"."victim_address", "puns"."operator",
  12.     "puns"."reason", "puns"."scope", "puns"."start", "puns"."end", "addrs"."uuid", "addrs"."address"
  13.   FROM "libertybans_simple_mutes" AS "puns"
  14.   INNER JOIN "libertybans_addresses" AS "addrs"
  15.   ON ("puns"."victim_type" = 0 AND "puns"."victim_uuid" = "addrs"."uuid"
  16.     OR "puns"."victim_type" = 1 AND "puns"."victim_address" = "addrs"."address"
  17.     OR "puns"."victim_type" = 2 AND ("puns"."victim_uuid" = "addrs"."uuid" OR "puns"."victim_address" = "addrs"."address"));
  18.  
  19. CREATE VIEW "libertybans_applicable_warns" AS
  20.   SELECT "puns"."id", "puns"."type", "puns"."victim_type", "puns"."victim_uuid", "puns"."victim_address", "puns"."operator",
  21.     "puns"."reason", "puns"."scope", "puns"."start", "puns"."end", "addrs"."uuid", "addrs"."address"
  22.   FROM "libertybans_simple_warns" AS "puns"
  23.   INNER JOIN "libertybans_addresses" AS "addrs"
  24.   ON ("puns"."victim_type" = 0 AND "puns"."victim_uuid" = "addrs"."uuid"
  25.     OR "puns"."victim_type" = 1 AND "puns"."victim_address" = "addrs"."address"
  26.     OR "puns"."victim_type" = 2 AND ("puns"."victim_uuid" = "addrs"."uuid" OR "puns"."victim_address" = "addrs"."address"));
  27.  
  28. CREATE VIEW "libertybans_applicable_active" AS
  29.   SELECT "id", "type", "victim_type", "victim_uuid", "victim_address", "operator", "reason", "scope", "start", "end", "uuid", "address"
  30.   FROM "libertybans_applicable_bans"
  31.   UNION ALL
  32.     SELECT "id", "type", "victim_type", "victim_uuid", "victim_address", "operator", "reason", "scope", "start", "end", "uuid", "address"
  33.     FROM "libertybans_applicable_mutes"
  34.   UNION ALL
  35.     SELECT "id", "type", "victim_type", "victim_uuid", "victim_address", "operator", "reason", "scope", "start", "end", "uuid", "address"
  36.     FROM "libertybans_applicable_warns";
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement