-
Notifications
You must be signed in to change notification settings - Fork 0
Database Schema
Lema El-Sherbiny edited this page Jul 26, 2021
·
10 revisions
| column name | data type | details | key |
|---|---|---|---|
| id | integer | NOT NULL | PK |
| username | string | NOT NULL | |
| string | NOT NULL, UNIQUE | ||
| hashedPassword | string | NOT NULL | |
| created_at | timestamp | NOT NULL | |
| updated_at | timestamp | NOT NULL |
- User.hasMany(models.Registration, { foreignKey: 'userId'});
| column name | data type | details | key |
|---|---|---|---|
| id | integer | NOT NULL | PK |
| eventId | integer | NOT NULL | FK |
| userId | integer | NOT NULL | FK |
| ticketNum | integer | NULL | |
| created_at | timestamp | NOT NULL | |
| updated_at | timestamp | NOT NULL |
- Registration.belongsTo(models.Event, { foreignKey: 'eventId'});
- Registration.belongsTo(models.User, { foreignKey: 'userId'});
| column name | data type | details | key |
|---|---|---|---|
| id | integer | NOT NULL | PK |
| name | string | NOT NULL | |
| time | string | NOT NULL | |
| detail | text | NOT NULL | |
| ticketPrice | decimal | NOT NULL | |
| location | string | NOT NULL | PK |
| pic | string | NOT NULL | PK |
| userId | integer | NOT NULL | FK |
| categoryId | integer | NOT NULL | FK |
| created_at | timestamp | NOT NULL | |
| updated_at | timestamp | NOT NULL |
- Event.belongsTo(models.Category, { foreignKey: 'categoryId'});
- Event.hasMany(models.Registration, { foreignKey: 'eventId'});
- Event.belongsToMany(models.User);
| column name | data type | details | key |
|---|---|---|---|
| id | integer | NOT NULL | PK |
| category | string | NULL | |
| created_at | timestamp | NOT NULL | |
| updated_at | timestamp | NOT NULL |
- Category.hasMany(models.Event, { foreignKey: 'categoryId'});
| column name | data type | details | key |
|---|---|---|---|
| id | integer | NOT NULL | PK |
| eventId | integer | NULL | |
| userId | integer | NULL | |
| created_at | timestamp | NOT NULL | |
| updated_at | timestamp | NOT NULL |
