Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up a database of NormalizedBillingPeriodRecords. #7

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions database/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.db*
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- CreateTable
CREATE TABLE "NormalizedBillingPeriodRecord" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"period_start_date" DATETIME NOT NULL,
"period_end_date" DATETIME NOT NULL,
"usage" REAL NOT NULL,
"analysis_type_override" TEXT NOT NULL,
"inclusion_override" BOOLEAN NOT NULL,
"model_config" TEXT NOT NULL,
"analysis_type" TEXT NOT NULL,
"default_inclusion_by_calculation" BOOLEAN NOT NULL,
"eliminated_as_outlier" BOOLEAN NOT NULL,
"whole_home_heat_loss_rate" REAL NOT NULL
);
3 changes: 3 additions & 0 deletions database/migrations/migration_lock.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "sqlite"
118 changes: 118 additions & 0 deletions database/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions database/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"devDependencies": {
"prisma": "^5.19.1"
},
"dependencies": {
"@prisma/client": "^5.19.1"
}
}
29 changes: 29 additions & 0 deletions database/schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
generator client {
provider = "prisma-client-js"
}


datasource db {
provider = "sqlite"
url = "file:./heat.db"
}


model NormalizedBillingPeriodRecord {
id Int @id @default(autoincrement())

// NormalizedBillingPeriodRecordBase (inherited)
// prisma does not support direct inheritance; therefore we directly coded these fields
period_start_date DateTime
period_end_date DateTime
usage Float
analysis_type_override String // AnalysisType in NormalizedBillingPeriodRecord of pydantic_models.py
inclusion_override Boolean

// NormalizedBillingPeriodRecord
model_config String // ConfigDict in NormalizedBillingPeriodRecord of pydantic_models.py
analysis_type String // AnalysisType in NormalizedBillingPeriodRecord of pydantic_models.py
default_inclusion_by_calculation Boolean
eliminated_as_outlier Boolean
whole_home_heat_loss_rate Float
}
Loading