Initial commit
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
const { Sequelize, DataTypes } = require('sequelize');
|
||||
|
||||
// Initialize SQLite database
|
||||
const sequelize = new Sequelize({
|
||||
dialect: 'sqlite',
|
||||
storage: './birthdays.sqlite',
|
||||
});
|
||||
|
||||
// Define the Birthday model
|
||||
const Birthday = sequelize.define('Birthday', {
|
||||
userId: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
},
|
||||
date: {
|
||||
type: DataTypes.STRING, // Store as MM-DD
|
||||
allowNull: false,
|
||||
},
|
||||
});
|
||||
|
||||
// Sync the database
|
||||
(async () => {
|
||||
await sequelize.sync({ alter: true });
|
||||
console.log('Database synced!');
|
||||
})();
|
||||
|
||||
module.exports = { sequelize, Birthday };
|
||||
Reference in New Issue
Block a user