Clean up Home models not being used
This commit is contained in:
parent
a1ab363349
commit
f0cc7306c4
@ -1,7 +1,6 @@
|
|||||||
import { Sequelize, Op } from 'sequelize';
|
import { Sequelize, Op } from 'sequelize';
|
||||||
import sequelizeConfig from '~/config/sequelize';
|
import sequelizeConfig from '~/config/sequelize';
|
||||||
import defineHouse from "./models/House";
|
import defineHouse from "./models/House";
|
||||||
import defineHome from "./models/Home";
|
|
||||||
|
|
||||||
const environmentConfig = sequelizeConfig["production"];
|
const environmentConfig = sequelizeConfig["production"];
|
||||||
|
|
||||||
@ -16,10 +15,9 @@ const sequelize = new Sequelize(
|
|||||||
});
|
});
|
||||||
|
|
||||||
const House = defineHouse(sequelize);
|
const House = defineHouse(sequelize);
|
||||||
const Home = defineHome(sequelize);
|
|
||||||
|
|
||||||
sequelize.sync()
|
sequelize.sync()
|
||||||
.then(() => console.log('Database & tables created!'))
|
.then(() => console.log('Database & tables created!'))
|
||||||
.catch((error) => console.error('Error syncing database:', error));
|
.catch((error) => console.error('Error syncing database:', error));
|
||||||
|
|
||||||
export { sequelize, Op, House, Home };
|
export { sequelize, Op, House };
|
||||||
|
|||||||
@ -1,65 +0,0 @@
|
|||||||
// server/models/Home.js
|
|
||||||
import { DataTypes } from "sequelize";
|
|
||||||
|
|
||||||
export default function House (sequelize) {
|
|
||||||
return sequelize.define(
|
|
||||||
"Home",
|
|
||||||
{
|
|
||||||
id: {
|
|
||||||
type: DataTypes.STRING,
|
|
||||||
allowNull: true,
|
|
||||||
unique: true,
|
|
||||||
primaryKey: true,
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
type: DataTypes.STRING,
|
|
||||||
allowNull: true,
|
|
||||||
},
|
|
||||||
url: {
|
|
||||||
type: DataTypes.STRING,
|
|
||||||
allowNull: true,
|
|
||||||
},
|
|
||||||
neighborhood: {
|
|
||||||
type: DataTypes.STRING,
|
|
||||||
allowNull: true,
|
|
||||||
},
|
|
||||||
area: {
|
|
||||||
type: DataTypes.INTEGER,
|
|
||||||
allowNull: true,
|
|
||||||
},
|
|
||||||
rooms: {
|
|
||||||
type: DataTypes.INTEGER,
|
|
||||||
allowNull: true,
|
|
||||||
},
|
|
||||||
price: {
|
|
||||||
type: DataTypes.STRING,
|
|
||||||
allowNull: true,
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
type: DataTypes.TEXT,
|
|
||||||
allowNull: true,
|
|
||||||
},
|
|
||||||
pic: {
|
|
||||||
type: DataTypes.TEXT,
|
|
||||||
allowNull: true,
|
|
||||||
},
|
|
||||||
baths: {
|
|
||||||
type: DataTypes.INTEGER,
|
|
||||||
allowNull: true,
|
|
||||||
},
|
|
||||||
level: {
|
|
||||||
type: DataTypes.STRING,
|
|
||||||
allowNull: true,
|
|
||||||
},
|
|
||||||
phone: {
|
|
||||||
type: DataTypes.STRING,
|
|
||||||
allowNull: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
tableName: "home",
|
|
||||||
timestamps: false, // createdAt y updatedAt
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
import { sequelize, Op, Home } from "../db.config";
|
|
||||||
|
|
||||||
async function insertOrUpdateHome(home: any) {
|
|
||||||
await Home.create(home);
|
|
||||||
console.log('Nueva casa insertada:', home.id);
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user