From a6f8f9d003ed10add381d942f022dd3826f4d612 Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Sun, 12 Oct 2014 13:48:39 -0400
Subject: Get V2 Groups working under PgSQL. Needed to re-create tables to
 satisy the generic handler type matching. There should be no existing data
 because it couldn't complete the first migration as-is.

---
 .../PGSQL/Resources/os_groups_Store.migrations     | 107 +++++++++++++++++++++
 1 file changed, 107 insertions(+)

diff --git a/OpenSim/Data/PGSQL/Resources/os_groups_Store.migrations b/OpenSim/Data/PGSQL/Resources/os_groups_Store.migrations
index 4573f71..7489bef 100644
--- a/OpenSim/Data/PGSQL/Resources/os_groups_Store.migrations
+++ b/OpenSim/Data/PGSQL/Resources/os_groups_Store.migrations
@@ -92,3 +92,110 @@ BEGIN;
 
 
 COMMIT;
+
+
+
+:VERSION 3
+
+BEGIN;
+
+-- Not a pretty way to do this, but it did not work as-is
+-- and nothing was found about converting between existing data
+-- and the new type.
+-- Since there should be nothing to preserve ...
+
+DROP TABLE IF EXISTS os_groups_groups CASCADE;
+
+CREATE TABLE os_groups_groups (
+  "GroupID" uuid PRIMARY KEY NOT NULL,
+  "Location" varchar(255) NOT NULL DEFAULT '',
+  "Name" varchar(255) NOT NULL DEFAULT '',
+  "Charter" text NOT NULL,
+  "InsigniaID" uuid NOT NULL,
+  "FounderID" uuid NOT NULL,
+  "MembershipFee" integer NOT NULL DEFAULT '0',
+  "OpenEnrollment" varchar(255) NOT NULL DEFAULT '',
+  "ShowInList" integer NOT NULL DEFAULT '0',
+  "AllowPublish" integer NOT NULL DEFAULT '0',
+  "MaturePublish" integer NOT NULL DEFAULT '0',
+  "OwnerRoleID" uuid NOT NULL
+);
+
+
+DROP TABLE IF EXISTS os_groups_membership;
+
+CREATE TABLE os_groups_membership (
+  "GroupID"uuid NOT NULL,
+  "PrincipalID" VARCHAR(255) NOT NULL DEFAULT '',
+  "SelectedRoleID" uuid NOT NULL,
+  "Contribution" integer NOT NULL DEFAULT '0',
+  "ListInProfile" integer NOT NULL DEFAULT '1',
+  "AcceptNotices" integer NOT NULL DEFAULT '1',
+  "AccessToken" uuid NOT NULL,
+  constraint os_groupmemberpk PRIMARY KEY ("GroupID", "PrincipalID")
+);
+
+
+
+DROP TABLE IF EXISTS os_groups_roles;
+
+CREATE TABLE os_groups_roles (
+  "GroupID" uuid NOT NULL,
+  "RoleID" uuid NOT NULL,
+  "Name" varchar(255) NOT NULL DEFAULT '',
+  "Description" varchar(255) NOT NULL DEFAULT '',
+  "Title" varchar(255) NOT NULL DEFAULT '',
+  "Powers" varchar(36) NOT NULL DEFAULT '',
+  constraint os_grouprolepk PRIMARY KEY  ("GroupID","RoleID")
+);
+
+
+DROP TABLE IF EXISTS os_groups_rolemembership;
+
+CREATE TABLE os_groups_rolemembership (
+  "GroupID" uuid NOT NULL,
+  "RoleID" uuid NOT NULL,
+  "PrincipalID" VARCHAR(255) NOT NULL DEFAULT '',
+  constraint os_grouprolememberpk PRIMARY KEY  ("GroupID","RoleID","PrincipalID")
+);
+
+
+DROP TABLE IF EXISTS os_groups_invites;
+
+CREATE TABLE os_groups_invites (
+  "InviteID" uuid NOT NULL,
+  "GroupID" uuid NOT NULL,
+  "RoleID" uuid NOT NULL,
+  "PrincipalID" VARCHAR(255) NOT NULL DEFAULT '',
+  "TMStamp" timestamp NOT NULL DEFAULT now(),
+  constraint os_groupinvitespk PRIMARY KEY  ("InviteID")
+);
+
+
+DROP TABLE IF EXISTS os_groups_notices;
+
+CREATE TABLE os_groups_notices (
+  "GroupID" uuid NOT NULL,
+  "NoticeID" uuid NOT NULL,
+  "TMStamp" integer NOT NULL DEFAULT '0',
+  "FromName" varchar(255) NOT NULL DEFAULT '',
+  "Subject" varchar(255) NOT NULL DEFAULT '',
+  "Message" text NOT NULL,
+  "HasAttachment" integer NOT NULL DEFAULT '0',
+  "AttachmentType" integer NOT NULL DEFAULT '0',
+  "AttachmentName" varchar(128) NOT NULL DEFAULT '',
+  "AttachmentItemID" uuid NOT NULL,
+  "AttachmentOwnerID" varchar(255) NOT NULL DEFAULT '',
+  constraint os_groupsnoticespk PRIMARY KEY  ("NoticeID")
+);
+
+
+DROP TABLE IF EXISTS os_groups_principals;
+
+CREATE TABLE os_groups_principals (
+  "PrincipalID" VARCHAR(255) NOT NULL DEFAULT '',
+  "ActiveGroupID" uuid NOT NULL,
+  constraint os_groupprincpk PRIMARY KEY  ("PrincipalID")
+);
+
+COMMIT;
\ No newline at end of file
-- 
cgit v1.1