chore(release): 0.2.5
[risinglegends.git] / migrations / 20230729184427_items.ts
1 import { Knex } from "knex";
2
3
4 export async function up(knex: Knex): Promise<void> {
5   return knex.schema.createTable('items', function(table) {
6     table.increments('id').primary();
7     table.string('name');
8     table.string('description');
9     table.string('effect_name');
10     table.string('icon_name');
11   }).createTable('player_items', function(table) {
12       table.integer('item_id');
13       table.string('player_id');
14       table.integer('amount').defaultTo(1);
15
16       table.primary(['item_id', 'player_id']);
17     });
18 }
19
20
21 export async function down(knex: Knex): Promise<void> {
22   return knex.schema.dropTable('items').dropTable('player_items');
23 }
24