Add new patch updates

pull/1/head
sigonasr2 3 years ago
parent e481597008
commit ed68984f55
  1. 5
      ngsplanner_patch.sql
  2. 8
      ngsplanner_schema.sql
  3. 118
      ngsplanner_seed.sql
  4. 207
      server.js

@ -0,0 +1,5 @@
/*9 Aug Database Patch*/
alter table potential add column description text;
alter table weapon_existence_data add column icon text;
alter table weapon_type add column shorthand text;
alter table weapon_existence_data add column special_name text;

@ -77,6 +77,7 @@ CREATE TABLE "weapon" (
CREATE TABLE "weapon_type" (
"id" SERIAL UNIQUE PRIMARY KEY,
"name" text,
"shorthand" text,
"icon" text,
"dmg_type" int
);
@ -84,7 +85,8 @@ CREATE TABLE "weapon_type" (
CREATE TABLE "potential" (
"id" SERIAL UNIQUE PRIMARY KEY,
"name" text,
"icon" text
"icon" text,
"description" text
);
CREATE TABLE "potential_data" (
@ -239,7 +241,9 @@ CREATE TABLE "weapon_existence_data" (
"weapon_type_id" int,
"weapon_id" int,
"popularity" int,
"editors_choice" int
"editors_choice" int,
"icon" text,
"special_name" text
);
CREATE TABLE "augment_type" (

@ -53,17 +53,17 @@ insert into weapon_type(name,icon,dmg_type) values('Rod','/icons/NGSUIItemRodMin
insert into weapon_type(name,icon,dmg_type) values('Talis','/icons/NGSUIItemTalisMini.png',2);
insert into weapon_type(name,icon,dmg_type) values('Wand','/icons/NGSUIItemWandMini.png',2);
insert into potential(name,icon) values('Recycler Unit','/icons/NGSUIItemPotentialAbility.png');
insert into potential(name,icon) values('Indomitable Unit','/icons/NGSUIItemPotentialAbility.png');
insert into potential(name,icon) values('Defensive Formation','/icons/NGSUIItemPotentialAbility.png');
insert into potential(name,icon) values('Offensive Formation','/icons/NGSUIItemPotentialAbility.png');
insert into potential(name,icon) values('Bastion Unit','/icons/NGSUIItemPotentialAbility.png');
insert into potential(name,icon) values('Meditation Unit','/icons/NGSUIItemPotentialAbility.png');
insert into potential(name,icon) values('Mustered Might Unit','/icons/NGSUIItemPotentialAbility.png');
insert into potential(name,icon) values('Dynamo Unit','/icons/NGSUIItemPotentialAbility.png');
insert into potential(name,icon) values('Berserk Unit','/icons/NGSUIItemPotentialAbility.png');
insert into potential(name,icon) values('Wellspring Unit','/icons/NGSUIItemPotentialAbility.png');
insert into potential(name,icon) values('Endurance Unit','/icons/NGSUIItemPotentialAbility.png');
insert into potential(name,icon,description) values('Recycler Unit','/icons/NGSUIItemPotentialAbility.png','Test description for Recycler Unit. Provides {mel_dmg}% melee dmg');
insert into potential(name,icon,description) values('Indomitable Unit','/icons/NGSUIItemPotentialAbility.png','Test description for Indomitable Unit. Provides {mel_dmg}% melee dmg');
insert into potential(name,icon,description) values('Defensive Formation','/icons/NGSUIItemPotentialAbility.png','Test description for Defensive Formation. Provides {mel_dmg}% melee dmg');
insert into potential(name,icon,description) values('Offensive Formation','/icons/NGSUIItemPotentialAbility.png','Test description for Offensive Formation. Provides {mel_dmg}% melee dmg');
insert into potential(name,icon,description) values('Bastion Unit','/icons/NGSUIItemPotentialAbility.png','Test description for Bastion Unit. Provides {mel_dmg}% melee dmg');
insert into potential(name,icon,description) values('Meditation Unit','/icons/NGSUIItemPotentialAbility.png','Test description for Meditation Unit. Provides {mel_dmg}% melee dmg');
insert into potential(name,icon,description) values('Mustered Might Unit','/icons/NGSUIItemPotentialAbility.png','Test description for Mustered Might Unit. Provides {mel_dmg}% melee dmg');
insert into potential(name,icon,description) values('Dynamo Unit','/icons/NGSUIItemPotentialAbility.png','Test description for Dynamo Unit. Provides {mel_dmg}% melee dmg');
insert into potential(name,icon,description) values('Berserk Unit','/icons/NGSUIItemPotentialAbility.png','Test description for Berserk Unit. Provides {mel_dmg}% melee dmg');
insert into potential(name,icon,description) values('Wellspring Unit','/icons/NGSUIItemPotentialAbility.png','Test description for Wellspring Unit. Provides {mel_dmg}% melee dmg');
insert into potential(name,icon,description) values('Endurance Unit','/icons/NGSUIItemPotentialAbility.png','Test description for Endurance Unit. Provides {mel_dmg}% melee dmg');
insert into class_level_data(class_id,name,level,hp,atk,def)
values((SELECT id from class WHERE name='Hunter' limit 1),'Hunter Lv.1',1,300,450,304);
@ -101,54 +101,54 @@ insert into potential_data(potential_id,name,level,mel_dmg,rng_dmg,tec_dmg,crit_
insert into potential_data(potential_id,name,level,mel_dmg,rng_dmg,tec_dmg,crit_rate,crit_dmg,pp_cost_reduction,active_pp_recovery,natural_pp_recovery,dmg_res,all_down_res,burn_res,freeze_res,blind_res,shock_res,panic_res,poison_res,battle_power_value,pb_gauge_build)
values((select id from potential where name='Indomitable Unit' limit 1),'Indomitable Unit Lv.1',1,1.18,1.18,1.18,0,0,0,0,0,0,1.10,0,0,0,0,0,0,10,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Sword' limit 1),(select id from weapon where name='Primm' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Spear' limit 1),(select id from weapon where name='Primm' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Wired Lance' limit 1),(select id from weapon where name='Primm' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Twin Dagger' limit 1),(select id from weapon where name='Primm' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Double Saber' limit 1),(select id from weapon where name='Primm' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Knuckles' limit 1),(select id from weapon where name='Primm' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Assault Rifle' limit 1),(select id from weapon where name='Primm' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Launcher' limit 1),(select id from weapon where name='Primm' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Twin Machine Guns' limit 1),(select id from weapon where name='Primm' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Rod' limit 1),(select id from weapon where name='Primm' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Talis' limit 1),(select id from weapon where name='Primm' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Wand' limit 1),(select id from weapon where name='Primm' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Sword' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Spear' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Wired Lance' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Twin Dagger' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Double Saber' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Knuckles' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Assault Rifle' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Launcher' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Twin Machine Guns' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Rod' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Talis' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice)
values((select id from weapon_type where name='Wand' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0);
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Sword' limit 1),(select id from weapon where name='Primm' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Spear' limit 1),(select id from weapon where name='Primm' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Wired Lance' limit 1),(select id from weapon where name='Primm' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Twin Dagger' limit 1),(select id from weapon where name='Primm' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Double Saber' limit 1),(select id from weapon where name='Primm' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Knuckles' limit 1),(select id from weapon where name='Primm' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Assault Rifle' limit 1),(select id from weapon where name='Primm' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Launcher' limit 1),(select id from weapon where name='Primm' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Twin Machine Guns' limit 1),(select id from weapon where name='Primm' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Rod' limit 1),(select id from weapon where name='Primm' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Talis' limit 1),(select id from weapon where name='Primm' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Wand' limit 1),(select id from weapon where name='Primm' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Sword' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Spear' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Wired Lance' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Twin Dagger' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Double Saber' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Knuckles' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Assault Rifle' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Launcher' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Twin Machine Guns' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Rod' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Talis' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0,'');
insert into weapon_existence_data(weapon_type_id,weapon_id,popularity,editors_choice,icon)
values((select id from weapon_type where name='Wand' limit 1),(select id from weapon where name='Tzvia' limit 1),0,0,'');
insert into roles(name)

@ -212,32 +212,61 @@ const ENDPOINTDATA=[
}
]
app.get(PREFIX+"/databases",(req,res)=>{
db.query('select * from pg_database where datname like \'ngsplanner%\' order by datname desc limit 100')
.then((data)=>{
res.status(200).json(data.rows)
})
.catch((err)=>{
res.status(500).send(err.message)
})
})
app.post(PREFIX+"/databases/restorefrombackup",(req,res)=>{
if (req.body.database) {
db3.query('select * from pg_database where datname=$1',[req.body.database])
for (var test of ["","/test"]) {
app.get(PREFIX+test+"/databases",(req,res)=>{
db.query('select * from pg_database where datname like \'ngsplanner%\' order by datname desc limit 100')
.then((data)=>{
if (data.rows.length>0) {
db.end(()=>{})
return db3.query('select pg_terminate_backend (pid) from pg_stat_activity where pg_stat_activity.datname=\'ngsplanner\'')
} else {
throw "Could not find requested database "+req.body.database
}
res.status(200).json(data.rows)
})
.catch((err)=>{
res.status(500).send(err.message)
})
})
app.post(PREFIX+test+"/databases/restorefrombackup",(req,res)=>{
if (req.body.database) {
db3.query('select * from pg_database where datname=$1',[req.body.database])
.then((data)=>{
if (data.rows.length>0) {
db.end(()=>{})
return db3.query('select pg_terminate_backend (pid) from pg_stat_activity where pg_stat_activity.datname=\'ngsplanner\'')
} else {
throw "Could not find requested database "+req.body.database
}
})
.then(()=>{
return db3.query('drop database ngsplanner')
})
.then(()=>{
return db3.query('create database ngsplanner with template '+req.body.database)
})
.then(()=>{
db = new Pool({
user: 'postgres',
password: '',
host: 'postgres',
database: 'ngsplanner',
port: 5432,
})
res.status(200).send("Done!")
})
.catch((err)=>{
console.log(err.message)
res.status(500).send(err.message)
})
} else {
res.status(500).send("Invalid data!")
}
})
app.post(PREFIX+test+"/databases/testtolive",(req,res)=>{
db.end(()=>{})
db2.end(()=>{})
db3.query('select pg_terminate_backend (pid) from pg_stat_activity where pg_stat_activity.datname=\'ngsplanner\' or pg_stat_activity.datname=\'ngsplanner2\'')
.then(()=>{
return db3.query('drop database ngsplanner')
return db3.query('drop database ngsplanner')
})
.then(()=>{
return db3.query('create database ngsplanner with template '+req.body.database)
return db3.query('create database ngsplanner with template ngsplanner2')
})
.then(()=>{
db = new Pool({
@ -247,103 +276,75 @@ app.post(PREFIX+"/databases/restorefrombackup",(req,res)=>{
database: 'ngsplanner',
port: 5432,
})
db2 = new Pool({
user: 'postgres',
password: '',
host: 'postgres',
database: 'ngsplanner2',
port: 5432,
})
res.status(200).send("Done!")
})
.catch((err)=>{
console.log(err.message)
res.status(500).send(err.message)
})
} else {
res.status(500).send("Invalid data!")
}
})
app.post(PREFIX+"/databases/testtolive",(req,res)=>{
db.end(()=>{})
db2.end(()=>{})
db3.query('select pg_terminate_backend (pid) from pg_stat_activity where pg_stat_activity.datname=\'ngsplanner\' or pg_stat_activity.datname=\'ngsplanner2\'')
.then(()=>{
return db3.query('drop database ngsplanner')
})
.then(()=>{
return db3.query('create database ngsplanner with template ngsplanner2')
})
.then(()=>{
db = new Pool({
user: 'postgres',
password: '',
host: 'postgres',
database: 'ngsplanner',
port: 5432,
app.post(PREFIX+test+"/databases/livetotest",(req,res)=>{
db.end(()=>{})
db2.end(()=>{})
db3.query('select pg_terminate_backend (pid) from pg_stat_activity where pg_stat_activity.datname=\'ngsplanner\' or pg_stat_activity.datname=\'ngsplanner2\'')
.then(()=>{
return db3.query('drop database ngsplanner2')
})
db2 = new Pool({
user: 'postgres',
password: '',
host: 'postgres',
database: 'ngsplanner2',
port: 5432,
.then(()=>{
return db3.query('create database ngsplanner2 with template ngsplanner')
})
res.status(200).send("Done!")
})
.catch((err)=>{
console.log(err.message)
res.status(500).send(err.message)
})
})
app.post(PREFIX+"/databases/livetotest",(req,res)=>{
db.end(()=>{})
db2.end(()=>{})
db3.query('select pg_terminate_backend (pid) from pg_stat_activity where pg_stat_activity.datname=\'ngsplanner\' or pg_stat_activity.datname=\'ngsplanner2\'')
.then(()=>{
return db3.query('drop database ngsplanner2')
})
.then(()=>{
return db3.query('create database ngsplanner2 with template ngsplanner')
})
.then(()=>{
db = new Pool({
user: 'postgres',
password: '',
host: 'postgres',
database: 'ngsplanner',
port: 5432,
.then(()=>{
db = new Pool({
user: 'postgres',
password: '',
host: 'postgres',
database: 'ngsplanner',
port: 5432,
})
db2 = new Pool({
user: 'postgres',
password: '',
host: 'postgres',
database: 'ngsplanner2',
port: 5432,
})
res.status(200).send("Done!")
})
db2 = new Pool({
user: 'postgres',
password: '',
host: 'postgres',
database: 'ngsplanner2',
port: 5432,
.catch((err)=>{
res.status(500).send(err.message)
})
res.status(200).send("Done!")
})
.catch((err)=>{
res.status(500).send(err.message)
})
})
app.post(PREFIX+"/databases/backup",(req,res)=>{
db.end(()=>{})
var date = new Date()
db3.query('select pg_terminate_backend (pid) from pg_stat_activity where pg_stat_activity.datname=\'ngsplanner\'')
.then(()=>{
return db3.query('create database ngsplanner'+String(date.getFullYear()).padStart(4,'0')+String(date.getMonth()).padStart(2,'0')+String(date.getDate()).padStart(2,'0')+String(date.getHours()).padStart(2,'0')+String(date.getMinutes()).padStart(2,'0')+String(date.getSeconds()).padStart(2,'0')+' with template ngsplanner')
})
.then(()=>{
db = new Pool({
user: 'postgres',
password: '',
host: 'postgres',
database: 'ngsplanner',
port: 5432,
app.post(PREFIX+test+"/databases/backup",(req,res)=>{
db.end(()=>{})
var date = new Date()
db3.query('select pg_terminate_backend (pid) from pg_stat_activity where pg_stat_activity.datname=\'ngsplanner\'')
.then(()=>{
return db3.query('create database ngsplanner'+String(date.getFullYear()).padStart(4,'0')+String(date.getMonth()).padStart(2,'0')+String(date.getDate()).padStart(2,'0')+String(date.getHours()).padStart(2,'0')+String(date.getMinutes()).padStart(2,'0')+String(date.getSeconds()).padStart(2,'0')+' with template ngsplanner')
})
.then(()=>{
db = new Pool({
user: 'postgres',
password: '',
host: 'postgres',
database: 'ngsplanner',
port: 5432,
})
res.status(200).send("Done!")
})
.catch((err)=>{
res.status(500).send(err.message)
})
res.status(200).send("Done!")
})
.catch((err)=>{
res.status(500).send(err.message)
})
})
}
function CreateDynamicEndpoints() {
ENDPOINTDATA.forEach((endpoint)=>{

Loading…
Cancel
Save