Commit 4a618c01 authored by Kim, Subin's avatar Kim, Subin
Browse files

Model

parent d55253a5
import { Sequelize } from "sequelize"; import { Sequelize } from "sequelize";
// import UserModel from "../models/user.model.js";
import MovieModel from "../models/movie.model.js";
import dbConfig from "../config/db.config.js"; import dbConfig from "../config/db.config.js";
const sequelize = new Sequelize( const sequelize = new Sequelize(
...@@ -17,6 +19,11 @@ const sequelize = new Sequelize( ...@@ -17,6 +19,11 @@ const sequelize = new Sequelize(
} }
); );
// const User = UserModel(sequelize)
const Movie = MovieModel(sequelize)
export { export {
sequelize, sequelize,
// User,
Movie
} }
\ No newline at end of file
import Sequelize from "sequelize";
const { DataTypes } = Sequelize;
const MovieModel = (sequelize) => {
const Movie = sequelize.define(
"movie",
{
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
movieId: {
type: DataTypes.INTEGER
}
},
{
timestamps: true,
freezeTableName: true,
tableName: "movies"
}
);
return Movie;
};
export default MovieModel;
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment