From b1383770ffdadb8c296e9596120432e40cefdb53 Mon Sep 17 00:00:00 2001 From: Mario Wuensch Date: Fri, 24 Sep 2021 14:16:37 +0200 Subject: [PATCH] Schreiben erster Tabellen. --- SQL/1_tables/0 tblTemplate.txt | Bin 0 -> 5884 bytes SQL/1_tables/tblAlignments.sql | 54 ++++++++++++++ SQL/1_tables/tblArmors.sql | 68 ++++++++++++++++++ SQL/{tables => 1_tables}/tblCharacter.sql | 83 +++++++++++++--------- SQL/1_tables/tblDeities.sql | 62 ++++++++++++++++ SQL/1_tables/tblDeity2Domain.sql | 57 +++++++++++++++ SQL/1_tables/tblDomains.sql | 57 +++++++++++++++ SQL/1_tables/tblWeapons.sql | 67 +++++++++++++++++ SQL/insert/InsertAlignments.sql | 0 9 files changed, 413 insertions(+), 35 deletions(-) create mode 100644 SQL/1_tables/0 tblTemplate.txt create mode 100644 SQL/1_tables/tblAlignments.sql create mode 100644 SQL/1_tables/tblArmors.sql rename SQL/{tables => 1_tables}/tblCharacter.sql (54%) create mode 100644 SQL/1_tables/tblDeities.sql create mode 100644 SQL/1_tables/tblDeity2Domain.sql create mode 100644 SQL/1_tables/tblDomains.sql create mode 100644 SQL/1_tables/tblWeapons.sql create mode 100644 SQL/insert/InsertAlignments.sql diff --git a/SQL/1_tables/0 tblTemplate.txt b/SQL/1_tables/0 tblTemplate.txt new file mode 100644 index 0000000000000000000000000000000000000000..06438edbcefad93c1978e60485722af2c7ef48bb GIT binary patch literal 5884 zcmds*X>Sxq5QghBQvSny^O|rN6A{G%Bol{21cC&SkPup}J!7-M-nI7tk{_SseY)H` zJ+rgN075G?nyb6I?y9cp|NgycS1r@MX%{^GU{?Zf@txU$^=x8=^=(fx={2!KJGEDu zJF|0rIou6FkL{uX)4omZ*iHm@s5L3JSC?a_!cvGvGv-WCg8*?Ns6hjTl)LKpf%q@P zSElz^_%q9ejsH6TnRuKEcBDC^9t0TY+4&o2-I3<|l6o@ZqDrs&S88)VaGnSJQ{i?= z&_xMTU7P;x+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9wO!QPyvIe& zqUqJ0KfLBa-o;vhF4bM!1!8|w`W;++JGxQ!W^eyepT4Sifx^kAL_XF G!u' + + -- drop table tblAlignments + create table tblAlignments ( + + -- Primaerschluessel + constraint [PK_tblAlignments] primary key ([key]) + , [key] int identity(1, 1) not null + + -- ---------------------------------------------------------------------- + -- Parameter + -- ---------------------------------------------------------------------- + , [description] nvarchar(250) NOT NULL + + ) + + -- Alle 9 Alignments einfügen + insert into tblAlignments ([description]) + values (N'Lawful Good'), (N'Neutral Good'), (N'Chaotic Good'), (N'Lawful Neutral'), (N'Neutral'), (N'Chaotic Neutral'), (N'Lawful Evil'), (N'Neutral Evil'), (N'Chaotic Evil') + + if not exists (select * from sys.tables where object_id = object_id ('tblAlignments')) begin + print '' + print '************************************' + print 'Fehler beim Erstellen der Tabelle tblAlignments' + print '************************************' + print '' + end + +end /*else begin -- [if not exists (Tabelle)...] + + -- Hinzufuegen einer Spalte + if not exists (select * from syscolumns where name = 'nSeqDataXLink' and id = object_id('tblAlignments') and objectproperty(id, N'IsUserTable') = 1) begin + print 'alter table tblAlignments add nSeqDataXLink bigint null' + alter table tblAlignments add nSeqDataXLink bigint null + end + +end -- [if not exists (Tabelle)...]*/ +go + +-- :EOF: diff --git a/SQL/1_tables/tblArmors.sql b/SQL/1_tables/tblArmors.sql new file mode 100644 index 0000000..a2c7431 --- /dev/null +++ b/SQL/1_tables/tblArmors.sql @@ -0,0 +1,68 @@ +/* ************************************************************************* * + * + * Datei: tblArmors.sql + * + * Aufgabe: Tabelle tblArmors anlegen + * + * Aenderungen: + * 2021-09-23, MWN, erstellt. + * + * ************************************************************************* */ + +if not exists (select * from sys.tables where object_id = object_id (N'tblArmors')) begin + + -- Protokollausgabe + print 'Anlegen der Tabelle <' + db_name() + '.dbo.tblArmors>' + + -- drop table tblArmors + create table tblArmors ( + + -- Primaerschluessel + constraint [PK_tblArmors] primary key ([key]) + , [key] int identity(1, 1) not null + + -- ---------------------------------------------------------------------- + -- Allgemeine Parameter + -- ---------------------------------------------------------------------- + , [created] DateTime NOT NULL + , [lastModified] DateTime NOT NULL + + -- ---------------------------------------------------------------------- + -- Parameter + -- ---------------------------------------------------------------------- + , [name] nvarchar(250) NOT NULL + , [category] nvarchar(250) NOT NULL + , [cost] int NOT NULL + , [currency] nvarchar(250) NOT NULL + , [armorbonus] int NOT NULL + , [maxDexBonus] int NOT NULL + , [ArmorCheckPenalty] int NOT NULL + , [ArcaneSpellFailureChance] int NOT NULL + , [speed30] int NOT NULL + , [speed20] int NOT NULL + , [weight] int NOT NULL + , [hasMetal] bit NOT NULL + , [special] nvarchar(max) NOT NULL + + ) + + if not exists (select * from sys.tables where object_id = object_id ('tblArmors')) begin + print '' + print '************************************' + print 'Fehler beim Erstellen der Tabelle tblArmors' + print '************************************' + print '' + end + +end /*else begin -- [if not exists (Tabelle)...] + + -- Hinzufuegen einer Spalte + if not exists (select * from syscolumns where name = 'nSeqDataXLink' and id = object_id('tblArmors') and objectproperty(id, N'IsUserTable') = 1) begin + print 'alter table tblArmors add nSeqDataXLink bigint null' + alter table tblArmors add nSeqDataXLink bigint null + end + +end -- [if not exists (Tabelle)...]*/ +go + +-- :EOF: diff --git a/SQL/tables/tblCharacter.sql b/SQL/1_tables/tblCharacter.sql similarity index 54% rename from SQL/tables/tblCharacter.sql rename to SQL/1_tables/tblCharacter.sql index a21c70e..32bebb1 100644 --- a/SQL/tables/tblCharacter.sql +++ b/SQL/1_tables/tblCharacter.sql @@ -31,42 +31,55 @@ if not exists (select * from sys.tables where object_id = object_id (N'tblCharac -- Parameter -- ---------------------------------------------------------------------- , [playerLink] int NOT NULL + , [groupLink] int NOT NULL + , [classLink] int NOT NULL + , [raceLink] int NOT NULL + , [alignmentLink] int NOT NULL + , [deityLink] int NOT NULL + , [sizeLink] int NOT NULL , [name] nvarchar(250) NOT NULL - , [classLink] int NOT NULL - , [level] int NOT NULL - , [raceLink] int NOT NULL - , [alignmentLink] int NOT NULL - , [deityLink] int NOT NULL - , [sizeLink] int NOT NULL - , [age] int NOT NULL - , [gender] nvarchar(250) NOT NULL - , [height] decimal NOT NULL - , [weight] decimal NOT NULL - , [eyes] nvarchar(250) NOT NULL - , [hair] nvarchar(250) NOT NULL - , [skin] nvarchar(250) NOT NULL - , [strength] int NOT NULL - , [dexterity] int NOT NULL - , [constitution] int NOT NULL - , [intelligence] int NOT NULL - , [wisdom] int NOT NULL - , [charisma] int NOT NULL - , [strengthtemp] int NOT NULL - , [dexteritytemp] int NOT NULL - , [constitutiontemp] int NOT NULL - , [intelligencetemp] int NOT NULL - , [wisdomtemp] int NOT NULL - , [charismatemp] int NOT NULL - , [Fort] int NOT NULL - , [ref] int NOT NULL - , [will] int NOT NULL - , [baseAttack] int NOT NULL - , [hp] int NOT NULL - , [tempHp] int NOT NULL - , [nonLethalDmg] int NOT NULL - , [speed] int NOT NULL - , [dmgReduction] int NOT NULL - , [miscIni] int NOT NULL + , [level] int NOT NULL + , [age] int NOT NULL + , [gender] nvarchar(250) NOT NULL + , [height] decimal NOT NULL + , [weight] decimal NOT NULL + , [eyes] nvarchar(250) NOT NULL + , [hair] nvarchar(250) NOT NULL + , [skin] nvarchar(250) NOT NULL + , [strength] int NOT NULL + , [dexterity] int NOT NULL + , [constitution] int NOT NULL + , [intelligence] int NOT NULL + , [wisdom] int NOT NULL + , [charisma] int NOT NULL + , [strengthtemp] int NULL + , [dexteritytemp] int NULL + , [constitutiontemp] int NULL + , [intelligencetemp] int NULL + , [wisdomtemp] int NULL + , [charismatemp] int NULL + , [fortitude] int NOT NULL + , [reflex] int NOT NULL + , [will] int NOT NULL + , [baseAttack] int NOT NULL + , [hp] int NOT NULL + , [tempHp] int NOT NULL + , [nonLethalDmg] int NOT NULL + , [speed] int NOT NULL + , [dmgReduction] int NOT NULL + , [spellResistance] int NOT NULL + , [miscInitiative] int NULL + , [miscArmor] int NULL + , [miscFortitude] int NULL + , [miscReflex] int NULL + , [miscWill] int NULL + , [miscGrapple] int NULL + , [exp] int NOT NULL + , [copper] int NOT NULL + , [silver] int NOT NULL + , [gold] int NOT NULL + , [platin] int NOT NULL + , ) if not exists (select * from sys.tables where object_id = object_id ('tblCharacter')) begin diff --git a/SQL/1_tables/tblDeities.sql b/SQL/1_tables/tblDeities.sql new file mode 100644 index 0000000..44bd955 --- /dev/null +++ b/SQL/1_tables/tblDeities.sql @@ -0,0 +1,62 @@ +/* ************************************************************************* * + * + * Datei: tblDeities.sql + * + * Aufgabe: Tabelle tblDeities anlegen + * + * Aenderungen: + * 2021-09-23, MWN, erstellt. + * + * ************************************************************************* */ + +if not exists (select * from sys.tables where object_id = object_id (N'tblDeities')) begin + + -- Protokollausgabe + print 'Anlegen der Tabelle <' + db_name() + '.dbo.tblDeities>' + + -- drop table tblDeities + create table tblDeities ( + + -- Primaerschluessel + constraint [PK_tblDeities] primary key ([key]) + , [key] int identity(1, 1) not null + + -- ---------------------------------------------------------------------- + -- Allgemeine Parameter + -- ---------------------------------------------------------------------- + , [created] DateTime NOT NULL + , [lastModified] DateTime NOT NULL + + -- ---------------------------------------------------------------------- + -- Parameter + -- ---------------------------------------------------------------------- + , [name] nvarchar(250) NOT NULL + , [alignmentLink] int NOT NULL + , [portfolio] nvarchar(250) NOT NULL + , [description] nvarchar(max) NOT NULL + , [favoredWeaponLink] int NOT NULL + + + + ) + + if not exists (select * from sys.tables where object_id = object_id ('tblDeities')) begin + print '' + print '************************************' + print 'Fehler beim Erstellen der Tabelle tblDeities' + print '************************************' + print '' + end + +end /*else begin -- [if not exists (Tabelle)...] + + -- Hinzufuegen einer Spalte + if not exists (select * from syscolumns where name = 'nSeqDataXLink' and id = object_id('tblDeities') and objectproperty(id, N'IsUserTable') = 1) begin + print 'alter table tblDeities add nSeqDataXLink bigint null' + alter table tblDeities add nSeqDataXLink bigint null + end + +end -- [if not exists (Tabelle)...]*/ +go + +-- :EOF: diff --git a/SQL/1_tables/tblDeity2Domain.sql b/SQL/1_tables/tblDeity2Domain.sql new file mode 100644 index 0000000..d65d9fd --- /dev/null +++ b/SQL/1_tables/tblDeity2Domain.sql @@ -0,0 +1,57 @@ +/* ************************************************************************* * + * + * Datei: tblDeity2Domain.sql + * + * Aufgabe: Tabelle tblDeity2Domain anlegen + * + * Aenderungen: + * 2021-09-23, MWN, erstellt. + * + * ************************************************************************* */ + +if not exists (select * from sys.tables where object_id = object_id (N'tblDeity2Domain')) begin + + -- Protokollausgabe + print 'Anlegen der Tabelle <' + db_name() + '.dbo.tblDeity2Domain>' + + -- drop table tblDeity2Domain + create table tblDeity2Domain ( + + -- Primaerschluessel + constraint [PK_tblDeity2Domain] primary key ([key]) + , [key] int identity(1, 1) not null + + -- ---------------------------------------------------------------------- + -- Allgemeine Parameter + -- ---------------------------------------------------------------------- + , [created] DateTime NOT NULL + , [lastModified] DateTime NOT NULL + + -- ---------------------------------------------------------------------- + -- Parameter + -- ---------------------------------------------------------------------- + , [deityLink] int NOT NULL + , [domainLink] int NOT NULL + + ) + + if not exists (select * from sys.tables where object_id = object_id ('tblDeity2Domain')) begin + print '' + print '************************************' + print 'Fehler beim Erstellen der Tabelle tblDeity2Domain' + print '************************************' + print '' + end + +end /*else begin -- [if not exists (Tabelle)...] + + -- Hinzufuegen einer Spalte + if not exists (select * from syscolumns where name = 'nSeqDataXLink' and id = object_id('tblDeity2Domain') and objectproperty(id, N'IsUserTable') = 1) begin + print 'alter table tblDeity2Domain add nSeqDataXLink bigint null' + alter table tblDeity2Domain add nSeqDataXLink bigint null + end + +end -- [if not exists (Tabelle)...]*/ +go + +-- :EOF: diff --git a/SQL/1_tables/tblDomains.sql b/SQL/1_tables/tblDomains.sql new file mode 100644 index 0000000..2118dd4 --- /dev/null +++ b/SQL/1_tables/tblDomains.sql @@ -0,0 +1,57 @@ +/* ************************************************************************* * + * + * Datei: tblDomains.sql + * + * Aufgabe: Tabelle tblDomains anlegen + * + * Aenderungen: + * 2021-09-23, MWN, erstellt. + * + * ************************************************************************* */ + +if not exists (select * from sys.tables where object_id = object_id (N'tblDomains')) begin + + -- Protokollausgabe + print 'Anlegen der Tabelle <' + db_name() + '.dbo.tblDomains>' + + -- drop table tblDomains + create table tblDomains ( + + -- Primaerschluessel + constraint [PK_tblDomains] primary key ([key]) + , [key] int identity(1, 1) not null + + -- ---------------------------------------------------------------------- + -- Allgemeine Parameter + -- ---------------------------------------------------------------------- + , [created] DateTime NOT NULL + , [lastModified] DateTime NOT NULL + + -- ---------------------------------------------------------------------- + -- Parameter + -- ---------------------------------------------------------------------- + , [name] nvarchar(250) NOT NULL + , [grantedPower] nvarchar(250) NOT NULL + + ) + + if not exists (select * from sys.tables where object_id = object_id ('tblDomains')) begin + print '' + print '************************************' + print 'Fehler beim Erstellen der Tabelle tblDomains' + print '************************************' + print '' + end + +end /*else begin -- [if not exists (Tabelle)...] + + -- Hinzufuegen einer Spalte + if not exists (select * from syscolumns where name = 'nSeqDataXLink' and id = object_id('tblDomains') and objectproperty(id, N'IsUserTable') = 1) begin + print 'alter table tblDomains add nSeqDataXLink bigint null' + alter table tblDomains add nSeqDataXLink bigint null + end + +end -- [if not exists (Tabelle)...]*/ +go + +-- :EOF: diff --git a/SQL/1_tables/tblWeapons.sql b/SQL/1_tables/tblWeapons.sql new file mode 100644 index 0000000..b930eab --- /dev/null +++ b/SQL/1_tables/tblWeapons.sql @@ -0,0 +1,67 @@ +/* ************************************************************************* * + * + * Datei: tblWeapons.sql + * + * Aufgabe: Tabelle tblWeapons anlegen + * + * Aenderungen: + * 2021-09-23, MWN, erstellt. + * + * ************************************************************************* */ + +if not exists (select * from sys.tables where object_id = object_id (N'tblWeapons')) begin + + -- Protokollausgabe + print 'Anlegen der Tabelle <' + db_name() + '.dbo.tblWeapons>' + + -- drop table tblWeapons + create table tblWeapons ( + + -- Primaerschluessel + constraint [PK_tblWeapons] primary key ([key]) + , [key] int identity(1, 1) not null + + -- ---------------------------------------------------------------------- + -- Allgemeine Parameter + -- ---------------------------------------------------------------------- + , [created] DateTime NOT NULL + , [lastModified] DateTime NOT NULL + + -- ---------------------------------------------------------------------- + -- Parameter + -- ---------------------------------------------------------------------- + , [name] nvarchar(250) NOT NULL + , [category] nvarchar(250) NOT NULL + , [cost] int NOT NULL + , [currency] nvarchar(250) NOT NULL + , [dmgSmall] nvarchar(250) NOT NULL + , [dmgMedium] nvarchar(250) NOT NULL + , [critrange] nvarchar(250) NOT NULL + , [crit] int NOT NULL + , [range] nvarchar(250) NOT NULL + , [weight] int NOT NULL + , [damagetype] nvarchar(250) NOT NULL + , [special] nvarchar(250) NOT NULL + + ) + + if not exists (select * from sys.tables where object_id = object_id ('tblWeapons')) begin + print '' + print '************************************' + print 'Fehler beim Erstellen der Tabelle tblWeapons' + print '************************************' + print '' + end + +end /*else begin -- [if not exists (Tabelle)...] + + -- Hinzufuegen einer Spalte + if not exists (select * from syscolumns where name = 'nSeqDataXLink' and id = object_id('tblWeapons') and objectproperty(id, N'IsUserTable') = 1) begin + print 'alter table tblWeapons add nSeqDataXLink bigint null' + alter table tblWeapons add nSeqDataXLink bigint null + end + +end -- [if not exists (Tabelle)...]*/ +go + +-- :EOF: diff --git a/SQL/insert/InsertAlignments.sql b/SQL/insert/InsertAlignments.sql new file mode 100644 index 0000000..e69de29