inital commit
This commit is contained in:
43
migrations/20240614065806-create-event.js
Normal file
43
migrations/20240614065806-create-event.js
Normal file
@@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
/** @type {import('sequelize-cli').Migration} */
|
||||
module.exports = {
|
||||
async up(queryInterface, Sequelize) {
|
||||
await queryInterface.createTable('events', {
|
||||
id: {
|
||||
allowNull: false,
|
||||
autoIncrement: true,
|
||||
primaryKey: true,
|
||||
type: Sequelize.INTEGER
|
||||
},
|
||||
uniqueId: {
|
||||
type: Sequelize.STRING
|
||||
},
|
||||
eventType: {
|
||||
type: Sequelize.STRING
|
||||
},
|
||||
name: {
|
||||
type: Sequelize.STRING
|
||||
},
|
||||
date: {
|
||||
type: Sequelize.DATE
|
||||
},
|
||||
time: {
|
||||
type: Sequelize.TIME
|
||||
},
|
||||
dayOfWeek: {
|
||||
type: Sequelize.INTEGER
|
||||
},
|
||||
createdAt: {
|
||||
allowNull: false,
|
||||
type: Sequelize.DATE
|
||||
},
|
||||
updatedAt: {
|
||||
allowNull: false,
|
||||
type: Sequelize.DATE
|
||||
}
|
||||
});
|
||||
},
|
||||
async down(queryInterface, Sequelize) {
|
||||
await queryInterface.dropTable('Events');
|
||||
}
|
||||
};
|
||||
40
migrations/20240614070750-create-event-place.js
Normal file
40
migrations/20240614070750-create-event-place.js
Normal file
@@ -0,0 +1,40 @@
|
||||
'use strict';
|
||||
/** @type {import('sequelize-cli').Migration} */
|
||||
module.exports = {
|
||||
async up(queryInterface, Sequelize) {
|
||||
await queryInterface.createTable('event_places', {
|
||||
id: {
|
||||
allowNull: false,
|
||||
autoIncrement: true,
|
||||
primaryKey: true,
|
||||
type: Sequelize.INTEGER
|
||||
},
|
||||
street: {
|
||||
type: Sequelize.STRING
|
||||
},
|
||||
zipcode: {
|
||||
type: Sequelize.STRING
|
||||
},
|
||||
city: {
|
||||
type: Sequelize.STRING
|
||||
},
|
||||
state: {
|
||||
type: Sequelize.STRING
|
||||
},
|
||||
country: {
|
||||
type: Sequelize.STRING
|
||||
},
|
||||
createdAt: {
|
||||
allowNull: false,
|
||||
type: Sequelize.DATE
|
||||
},
|
||||
updatedAt: {
|
||||
allowNull: false,
|
||||
type: Sequelize.DATE
|
||||
}
|
||||
});
|
||||
},
|
||||
async down(queryInterface, Sequelize) {
|
||||
await queryInterface.dropTable('event_places');
|
||||
}
|
||||
};
|
||||
15
migrations/20240614072233-add-orderId-to-menuItems.js
Normal file
15
migrations/20240614072233-add-orderId-to-menuItems.js
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.addColumn('menu_items', 'order_id', {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 0 // Standardwert, falls benötigt
|
||||
});
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.removeColumn('menu_items', 'order_id');
|
||||
}
|
||||
};
|
||||
68
migrations/20240614144712-create-institution.js
Normal file
68
migrations/20240614144712-create-institution.js
Normal file
@@ -0,0 +1,68 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.createTable('institutions', {
|
||||
id: {
|
||||
allowNull: false,
|
||||
autoIncrement: true,
|
||||
primaryKey: true,
|
||||
type: Sequelize.INTEGER
|
||||
},
|
||||
name: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: false
|
||||
},
|
||||
street: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: true
|
||||
},
|
||||
zipcode: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: true
|
||||
},
|
||||
city: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: true
|
||||
},
|
||||
phone: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: true
|
||||
},
|
||||
fax: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: true
|
||||
},
|
||||
email: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: true
|
||||
}
|
||||
});
|
||||
|
||||
await queryInterface.createTable('InstitutionContactPerson', {
|
||||
institution_id: {
|
||||
type: Sequelize.INTEGER,
|
||||
references: {
|
||||
model: 'institutions',
|
||||
key: 'id'
|
||||
},
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'CASCADE'
|
||||
},
|
||||
contact_person_id: {
|
||||
type: Sequelize.INTEGER,
|
||||
references: {
|
||||
model: 'contact_persons',
|
||||
key: 'id'
|
||||
},
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'CASCADE'
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.dropTable('InstitutionContactPerson');
|
||||
await queryInterface.dropTable('institutions');
|
||||
}
|
||||
};
|
||||
51
migrations/20240614154022-create-event.js
Normal file
51
migrations/20240614154022-create-event.js
Normal file
@@ -0,0 +1,51 @@
|
||||
'use strict';
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.createTable('Events', {
|
||||
id: {
|
||||
allowNull: false,
|
||||
autoIncrement: true,
|
||||
primaryKey: true,
|
||||
type: Sequelize.INTEGER
|
||||
},
|
||||
title: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: false
|
||||
},
|
||||
description: {
|
||||
type: Sequelize.TEXT
|
||||
},
|
||||
date: {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: false
|
||||
},
|
||||
repeat: {
|
||||
type: Sequelize.STRING
|
||||
},
|
||||
interval: {
|
||||
type: Sequelize.INTEGER
|
||||
},
|
||||
institution_id: {
|
||||
type: Sequelize.INTEGER,
|
||||
references: {
|
||||
model: 'institutions',
|
||||
key: 'id'
|
||||
},
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'SET NULL'
|
||||
},
|
||||
event_place_id: {
|
||||
type: Sequelize.INTEGER,
|
||||
references: {
|
||||
model: 'event_places',
|
||||
key: 'id'
|
||||
},
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'SET NULL'
|
||||
}
|
||||
});
|
||||
},
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.dropTable('Events');
|
||||
}
|
||||
};
|
||||
28
migrations/20240614154028-create-event-contact-person.js
Normal file
28
migrations/20240614154028-create-event-contact-person.js
Normal file
@@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.createTable('EventContactPersons', {
|
||||
event_id: {
|
||||
type: Sequelize.INTEGER,
|
||||
references: {
|
||||
model: 'Events',
|
||||
key: 'id'
|
||||
},
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'CASCADE'
|
||||
},
|
||||
contact_person_id: {
|
||||
type: Sequelize.INTEGER,
|
||||
references: {
|
||||
model: 'contact_persons',
|
||||
key: 'id'
|
||||
},
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'CASCADE'
|
||||
}
|
||||
});
|
||||
},
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.dropTable('EventContactPersons');
|
||||
}
|
||||
};
|
||||
20
migrations/20240614171723-add-institution-id-to-events.js
Normal file
20
migrations/20240614171723-add-institution-id-to-events.js
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.addColumn('events', 'institution_id', {
|
||||
type: Sequelize.INTEGER,
|
||||
references: {
|
||||
model: 'institutions',
|
||||
key: 'id'
|
||||
},
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'SET NULL',
|
||||
allowNull: true
|
||||
});
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.removeColumn('events', 'institution_id');
|
||||
}
|
||||
};
|
||||
20
migrations/20240614171839-add-event-place-id-to-events.js
Normal file
20
migrations/20240614171839-add-event-place-id-to-events.js
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.addColumn('events', 'event_place_id', {
|
||||
type: Sequelize.INTEGER,
|
||||
references: {
|
||||
model: 'event_places',
|
||||
key: 'id'
|
||||
},
|
||||
onUpdate: 'CASCADE',
|
||||
onDelete: 'SET NULL',
|
||||
allowNull: true
|
||||
});
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.removeColumn('events', 'event_place_id');
|
||||
}
|
||||
};
|
||||
14
migrations/20240614181737-add-end-time-to-events.js
Normal file
14
migrations/20240614181737-add-end-time-to-events.js
Normal file
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.addColumn('events', 'endTime', {
|
||||
type: Sequelize.TIME,
|
||||
allowNull: true,
|
||||
});
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.removeColumn('events', 'endTime');
|
||||
}
|
||||
};
|
||||
15
migrations/20240614212845-add-date-to-worships.js
Normal file
15
migrations/20240614212845-add-date-to-worships.js
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.addColumn('worships', 'date', {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: '2024-01-01'
|
||||
});
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.removeColumn('worships', 'date');
|
||||
}
|
||||
};
|
||||
41
migrations/20240615085511-create-pages-table.js
Normal file
41
migrations/20240615085511-create-pages-table.js
Normal file
@@ -0,0 +1,41 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.createTable('pages', {
|
||||
id: {
|
||||
allowNull: false,
|
||||
autoIncrement: true,
|
||||
primaryKey: true,
|
||||
type: Sequelize.INTEGER
|
||||
},
|
||||
link: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: false,
|
||||
unique: true
|
||||
},
|
||||
name: {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: false
|
||||
},
|
||||
content: {
|
||||
type: Sequelize.TEXT,
|
||||
allowNull: true
|
||||
},
|
||||
createdAt: {
|
||||
allowNull: false,
|
||||
type: Sequelize.DATE,
|
||||
defaultValue: Sequelize.fn('now')
|
||||
},
|
||||
updatedAt: {
|
||||
allowNull: false,
|
||||
type: Sequelize.DATE,
|
||||
defaultValue: Sequelize.fn('now')
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.dropTable('pages');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user