-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdatabase.js
67 lines (62 loc) · 1.31 KB
/
database.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const Sequelize = require('sequelize');
const database = new Sequelize('database', 'username', 'password', {
host: 'localhost',
dialect: 'sqlite',
logging: false,
storage: 'database.sqlite',
});
module.exports.User = database.define('user', {
id: {
type: Sequelize.STRING,
primaryKey: true,
unique: true,
},
balance: {
type: Sequelize.INTEGER,
defaultValue: 0,
},
}, {
timestamps: false,
}
);
module.exports.UserItems = database.define('user_items', {
user_id: Sequelize.STRING,
item: Sequelize.INTEGER,
amount: {
type: Sequelize.INTEGER,
allowNull: false,
},
}, {
timestamps: false,
}
);
module.exports.CurrencyShop = database.define('currency_shop', {
name: {
type: Sequelize.STRING,
unique: true,
},
cost: {
type: Sequelize.INTEGER,
allowNull: false,
}
}, {
timestamps: false,
}
);
module.exports.petCooldown = database.define('pet_cooldown', {
user_id: {
primaryKey: true,
type: Sequelize.STRING,
unique: true,
},
expiry: Sequelize.BIGINT,
}
);
module.exports.adventureUser = database.define('adventure_user', {
id: {
primaryKey: true,
type: Sequelize.STRING,
unique: true,
}
}
);