add createdAt, updatedAt fields; add default values for not null fields
This commit is contained in:
@@ -53,12 +53,20 @@ module.exports = {
|
||||
sold: {
|
||||
type: Sequelize.BOOLEAN,
|
||||
allowNull: false
|
||||
},
|
||||
createdAt: {
|
||||
type: Sequelize.DATE,
|
||||
defaultValue: Sequelize.literal("NOW()")
|
||||
},
|
||||
updatedAt: {
|
||||
type: Sequelize.DATE,
|
||||
defaultValue: Sequelize.literal("NOW()")
|
||||
}
|
||||
};
|
||||
return queryInterface.createTable("realEstates", tableFields);
|
||||
return queryInterface.createTable("RealEstates", tableFields);
|
||||
},
|
||||
|
||||
down: queryInterface => {
|
||||
return queryInterface.dropTable("realEstates", {});
|
||||
return queryInterface.dropTable("RealEstates", {});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -10,8 +10,13 @@ module.exports = {
|
||||
primaryKey: true
|
||||
},
|
||||
areaToSearch: {
|
||||
type: Sequelize.GEOMETRY("POINT", 4326),
|
||||
allowNull: false
|
||||
type: Sequelize.GEOMETRY("POLYGON", 4326),
|
||||
allowNull: false,
|
||||
defaultValue: {
|
||||
type: "Polygon",
|
||||
coordinates: [[[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]],
|
||||
crs: { type: "name", properties: { name: "EPSG:4326" } }
|
||||
}
|
||||
},
|
||||
realEstateType: {
|
||||
type: Sequelize.TEXT,
|
||||
@@ -19,7 +24,8 @@ module.exports = {
|
||||
},
|
||||
adType: {
|
||||
type: Sequelize.TEXT,
|
||||
allowNull: false
|
||||
allowNull: false,
|
||||
defaultValue: "sell"
|
||||
},
|
||||
email: Sequelize.TEXT,
|
||||
locality: Sequelize.TEXT,
|
||||
@@ -30,31 +36,44 @@ module.exports = {
|
||||
country: Sequelize.TEXT,
|
||||
sizeMin: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false
|
||||
allowNull: false,
|
||||
defaultValue: 0
|
||||
},
|
||||
sizeMax: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false
|
||||
allowNull: false,
|
||||
defaultValue: 0
|
||||
},
|
||||
priceMin: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false
|
||||
allowNull: false,
|
||||
defaultValue: 0
|
||||
},
|
||||
priceMax: {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: false
|
||||
allowNull: false,
|
||||
defaultValue: 0
|
||||
},
|
||||
gardenSizeMin: Sequelize.INTEGER,
|
||||
gardenSizeMax: Sequelize.INTEGER,
|
||||
subscribed: {
|
||||
type: Sequelize.BOOLEAN,
|
||||
allowNull: false
|
||||
allowNull: false,
|
||||
defaultValue: true
|
||||
},
|
||||
createdAt: {
|
||||
type: Sequelize.DATE,
|
||||
defaultValue: Sequelize.literal("NOW()")
|
||||
},
|
||||
updatedAt: {
|
||||
type: Sequelize.DATE,
|
||||
defaultValue: Sequelize.literal("NOW()")
|
||||
}
|
||||
};
|
||||
return queryInterface.createTable("searchRequests", tableFields);
|
||||
return queryInterface.createTable("SearchRequests", tableFields);
|
||||
},
|
||||
|
||||
down: queryInterface => {
|
||||
return queryInterface.dropTable("searchRequests", {});
|
||||
return queryInterface.dropTable("SearchRequests", {});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@ module.exports = {
|
||||
allowNull: false,
|
||||
primaryKey: true,
|
||||
references: {
|
||||
model: "searchRequests",
|
||||
model: "SearchRequests",
|
||||
key: "id"
|
||||
},
|
||||
onUpdate: "CASCADE",
|
||||
@@ -24,7 +24,7 @@ module.exports = {
|
||||
allowNull: false,
|
||||
primaryKey: true,
|
||||
references: {
|
||||
model: "realEstates",
|
||||
model: "RealEstates",
|
||||
key: "id"
|
||||
},
|
||||
onUpdate: "CASCADE",
|
||||
@@ -34,12 +34,20 @@ module.exports = {
|
||||
type: Sequelize.BOOLEAN,
|
||||
allowNull: false,
|
||||
defaultValue: false
|
||||
},
|
||||
createdAt: {
|
||||
type: Sequelize.DATE,
|
||||
defaultValue: Sequelize.literal("NOW()")
|
||||
},
|
||||
updatedAt: {
|
||||
type: Sequelize.DATE,
|
||||
defaultValue: Sequelize.literal("NOW()")
|
||||
}
|
||||
};
|
||||
return queryInterface.createTable("searchRequestMatches", tableFields);
|
||||
return queryInterface.createTable("SearchRequestMatches", tableFields);
|
||||
},
|
||||
|
||||
down: queryInterface => {
|
||||
return queryInterface.dropTable("searchRequestMatches", {});
|
||||
return queryInterface.dropTable("SearchRequestMatches", {});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user