--- /dev/null
+import { Knex } from "knex";
+
+
+export async function up(knex: Knex): Promise<void> {
+ return knex.schema.alterTable('inventory', function(table) {
+ ['strength','dexterity','intelligence','constitution'].forEach(s => {
+ table.dropColumn(`boost_${s}`);
+ table.dropColumn(`requirement_${s}`);
+ });
+
+ table.dropColumn('boost_damage');
+ table.dropColumn('requirement_level');
+ }).alterTable('shop_items', function(table) {
+ ['strength','dexterity','intelligence','constitution'].forEach(s => {
+ table.dropColumn(`boost_${s}`);
+ table.dropColumn(`requirement_${s}`);
+ });
+
+ table.dropColumn('boost_damage');
+ table.dropColumn('requirement_level');
+ });
+}
+
+
+export async function down(knex: Knex): Promise<void> {
+}
+
i.name,
i.cost,
i.count,
- i.requirement_level,
- i.requirement_strength,
- i.requirement_constitution,
- i.requirement_dexterity,
- i.requirement_intelligence,
+ i.requirements,
i.profession,
- i.boost_strength,
- i.boost_constitution,
- i.boost_dexterity,
- i.boost_damage,
+ i.boosts,
i.maxAp,
i.currentAp,
e.equipment_slot,
export function listShopItems(where: Partial<ShopItem>): Promise<ShopItem[]> {
return db.select('*').from<ShopItem>('shop_items')
.where(where)
- .orderBy('requirement_level')
.orderBy('type')
- .orderBy('equipment_slot');
+ .orderBy('equipment_slot')
+ .orderByRaw(`requirements->>'level' asc`);
}
export function getShopItem(id: number): Promise<ShopItem> {