kashiash
4/1/2019 - 9:07 PM

#xaf obiekty i uprawnienia

#xaf obiekty i uprawnienia

create table "XPObjectType"
(
	OID INTEGER generated always as identity
		constraint "PK_XPObjectType"
			primary key,
	"TypeName" VARCHAR(254),
	"AssemblyName" VARCHAR(254)
);

 create table "XPWeakReference"
 (
 	"Oid" CHARACTER(36) not null
 		constraint "PK_XPWeakReference"
 			primary key,
 	"TargetType" INTEGER
 		constraint "FK_XPWeak_CEC05BA8"
 			references "XPObjectType",
 	"TargetKey" VARCHAR(100),
 	"OptimisticLockField" INTEGER,
 	"GCRecord" INTEGER,
 	"ObjectType" INTEGER
 		constraint "FK_XPWeak_4DF05395"
 			references "XPObjectType"
 );


drop table "PermissionPolicyRole";

 create table "PermissionPolicyRole"
 (
 	"Oid" CHARACTER(36) not null
 		constraint "PK_Permis_502F8305"
 			primary key,
 	"Name" VARCHAR(100),
 	"IsAdministrative" CHARACTER(1),
 	"CanEditModel" CHARACTER(1),
 	"PermissionPolicy" INTEGER,
 	"OptimisticLockField" INTEGER,
 	"GCRecord" INTEGER,
 	"ObjectType" INTEGER
 		constraint "FK_Permis_582B5998"
 			references "XPObjectType"
 );


drop table "PermissionPolicyNavig_E7A6B99F";

 create table "PermissionPolicyNavig_E7A6B99F"
 (
 	"Oid" CHARACTER(36) not null
 		constraint "PK_Permis_631D599D"
 			primary key,
 	"ItemPath" CLOB(1048576),
 	"NavigateState" INTEGER,
 	"Role" CHARACTER(36)
 		constraint "FK_Permis_62B13A8E"
 			references "PermissionPolicyRole",
 	"OptimisticLockField" INTEGER,
 	"GCRecord" INTEGER
 );

 create index "iGCRecord_988E06D0"
 	on "PermissionPolicyNavig_E7A6B99F" ("GCRecord");

 create index "iRole_Per_8194FC20"
 	on "PermissionPolicyNavig_E7A6B99F" ("Role");

 create index "iGCRecord_ADE62CA3"
 	on "PermissionPolicyRole" ("GCRecord");

 create index "iObjectTy_BA9AC15B"
 	on "PermissionPolicyRole" ("ObjectType");


 drop table "PermissionPolicyTypeP_2E43534B";
 create table "PermissionPolicyTypeP_2E43534B"
 (
 	"Oid" CHARACTER(36) not null
 		constraint "PK_Permis_2EE27DB3"
 			primary key,
 	"Role" CHARACTER(36)
 		constraint "FK_Permis_8C281BF9"
 			references "PermissionPolicyRole",
 	"TargetType" CLOB(1048576),
 	"ReadState" INTEGER,
 	"WriteState" INTEGER,
 	"CreateState" INTEGER,
 	"DeleteState" INTEGER,
 	"NavigateState" INTEGER,
 	"OptimisticLockField" INTEGER,
 	"GCRecord" INTEGER
 );
 drop table "PermissionPolicyMembe_E75478CE";
 create table "PermissionPolicyMembe_E75478CE"
 (
 	"Oid" CHARACTER(36) not null
 		constraint "PK_Permis_ACEA78E6"
 			primary key,
 	"Members" CLOB(1048576),
 	"ReadState" INTEGER,
 	"WriteState" INTEGER,
 	"Criteria" CLOB(1048576),
 	"TypePermissionObject" CHARACTER(36)
 		constraint "FK_Permis_ED56CB29"
 			references "PermissionPolicyTypeP_2E43534B",
 	"OptimisticLockField" INTEGER,
 	"GCRecord" INTEGER
 );

 create index "iGCRecord_15DF8C39"
 	on "PermissionPolicyMembe_E75478CE" ("GCRecord");

 create index "iTypePerm_9DC04002"
 	on "PermissionPolicyMembe_E75478CE" ("TypePermissionObject");

 drop table "PermissionPolicyObjec_6C6C082F";

 create table "PermissionPolicyObjec_6C6C082F"
 (
 	"Oid" CHARACTER(36) not null
 		constraint "PK_Permis_27D20807"
 			primary key,
 	"Criteria" CLOB(1048576),
 	"ReadState" INTEGER,
 	"WriteState" INTEGER,
 	"DeleteState" INTEGER,
 	"NavigateState" INTEGER,
 	"TypePermissionObject" CHARACTER(36)
 		constraint "FK_Permis_6A5A92EA"
 			references "PermissionPolicyTypeP_2E43534B",
 	"OptimisticLockField" INTEGER,
 	"GCRecord" INTEGER
 );

 create index "iGCRecord_9EE7FCD8"
 	on "PermissionPolicyObjec_6C6C082F" ("GCRecord");

 create index "iTypePerm_16F830E3"
 	on "PermissionPolicyObjec_6C6C082F" ("TypePermissionObject");

 create index "iGCRecord_FD9C9964"
 	on "PermissionPolicyTypeP_2E43534B" ("GCRecord");

 create index "iRole_Per_419ADFDA"
 	on "PermissionPolicyTypeP_2E43534B" ("Role");

 drop table "PermissionPolicyUserU_C5F59E67";

 create table "PermissionPolicyUserU_C5F59E67"
 (
 	"Roles" CHARACTER(36)
 		constraint "FK_Permis_296D2F11"
 			references "PermissionPolicyRole",
 	"Users" CHARACTER(36)
 		constraint "FK_Permis_5AEF6491"
 			references "PermissionPolicyUser",
 	OID CHARACTER(36) not null
 		constraint "PK_Permis_C7712587"
 			primary key,
 	"OptimisticLockField" INTEGER
 );

 create unique index "iRolesUse_CABDE69D"
 	on "PermissionPolicyUserU_C5F59E67" ("Roles", "Users");

 create index "iRoles_Pe_76EE7758"
 	on "PermissionPolicyUserU_C5F59E67" ("Roles");

 create index "iUsers_Pe_52567060"
 	on "PermissionPolicyUserU_C5F59E67" ("Users");

 create unique index "iTypeName_B43377D6"
 	on "XPObjectType" ("TypeName");



 create table "AuditedObjectWeakReference"
 (
 	"Oid" CHARACTER(36) not null
 		constraint "PK_Audite_7A20F563"
 			primary key
 		constraint "FK_Audite_3C51FBA4"
 			references "XPWeakReference",
 	"GuidId" CHARACTER(36),
 	"IntId" INTEGER,
 	"DisplayName" VARCHAR(250)
 );

 create table "AuditDataItemPersistent"
 (
 	"Oid" CHARACTER(36) not null
 		constraint "PK_AuditD_31D7EC57"
 			primary key,
 	"UserName" VARCHAR(100),
 	"ModifiedOn" TIMESTAMP(6),
 	"OperationType" VARCHAR(100),
 	"Description" VARCHAR(2048),
 	"AuditedObject" CHARACTER(36)
 		constraint "FK_AuditD_E2FFEBE0"
 			references "AuditedObjectWeakReference",
 	"OldObject" CHARACTER(36)
 		constraint "FK_AuditD_95BBF669"
 			references "XPWeakReference",
 	"NewObject" CHARACTER(36)
 		constraint "FK_AuditD_94A9BA69"
 			references "XPWeakReference",
 	"OldValue" VARCHAR(1024),
 	"NewValue" VARCHAR(1024),
 	"PropertyName" VARCHAR(100),
 	"OptimisticLockField" INTEGER,
 	"GCRecord" INTEGER
 );

 create index "iAuditedO_BDA51AC2"
 	on "AuditDataItemPersistent" ("AuditedObject");

 create index "iGCRecord_C5085562"
 	on "AuditDataItemPersistent" ("GCRecord");

 create index "iModified_41651924"
 	on "AuditDataItemPersistent" ("ModifiedOn");

 create index "iNewObjec_A35019B4"
 	on "AuditDataItemPersistent" ("NewObject");

 create index "iOldObjec_B11C19B5"
 	on "AuditDataItemPersistent" ("OldObject");

 create index "iOperatio_B839C690"
 	on "AuditDataItemPersistent" ("OperationType");

 create index "iUserName_42466D17"
 	on "AuditDataItemPersistent" ("UserName");

 create index "iGCRecord_8CFE1829"
 	on "XPWeakReference" ("GCRecord");

 create index "iObjectTy_8E118596"
 	on "XPWeakReference" ("ObjectType");

 create index "iTargetTy_862C06A6"
 	on "XPWeakReference" ("TargetType");