From 2e18dc7a532d07d6e53581e5076c7d61a45d6d65 Mon Sep 17 00:00:00 2001 From: Ran Guin Date: Tue, 11 May 2021 18:28:25 -0700 Subject: add first draft of normalized schema --- db/normalized/codes.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 db/normalized/codes.js (limited to 'db/normalized/codes.js') diff --git a/db/normalized/codes.js b/db/normalized/codes.js new file mode 100644 index 00000000..956fe56a --- /dev/null +++ b/db/normalized/codes.js @@ -0,0 +1,27 @@ +const { DataTypes } = require('sequelize'); + +const attributes = { + code: { + type: DataTypes.INTEGER(11), + primaryKey: true, + allowNull: false + }, + name: { + type: DataTypes.STRING(255) + } +} +const options = { + tableName: "codes", + comment: "", + timestamps: true, + createdAt: 'created_at', + updatedAt: 'updated_at', + indexes: [ + { + unique: true, + fields: ['code'] + } + ] +}; + +db["Code"] = db.define("codes_model", attributes, options); -- cgit v1.2.3