4 studio usage
This commit is contained in:
@ -148,7 +148,7 @@ function GenPrice(max = 1000) {
|
|||||||
|
|
||||||
const ClassTypes = ['Theory', 'Practice']
|
const ClassTypes = ['Theory', 'Practice']
|
||||||
const RegistrationStatuses = ['NotPaid', 'Paid']
|
const RegistrationStatuses = ['NotPaid', 'Paid']
|
||||||
const EquipmentUsageTypes = ['PayOnce', 'PayMonthly']
|
const UsageTypes = ['PayOnce', 'PayMonthly']
|
||||||
|
|
||||||
const COUNT = 10
|
const COUNT = 10
|
||||||
|
|
||||||
@ -196,8 +196,8 @@ script += 'INSERT INTO "Client" ("Person_id", phone, email, billing_account) ' +
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Studio
|
// Studio
|
||||||
script += 'INSERT INTO "Studio" (address, capacity, begin_date, duration) ' + Values(() => {
|
script += 'INSERT INTO "Studio" (address, capacity, begin_date, duration, usage_price, usage_type) ' + Values(() => {
|
||||||
return `(${GenAddress()}, ${GenInt(10, 80)}, ${GenTimestamp()}, ${GenIntervalHours(12)})`
|
return `(${GenAddress()}, ${GenInt(10, 80)}, ${GenTimestamp()}, ${GenIntervalHours(12)}, ${GenPrice(300)}, '${UsageTypes[GenMaxUInt(UsageTypes.length)]}')`
|
||||||
})
|
})
|
||||||
|
|
||||||
// Course
|
// Course
|
||||||
@ -232,7 +232,7 @@ script += Many(`INSERT INTO "FoodProduct" ("FoodProductEnum_id", "Class_begin_da
|
|||||||
|
|
||||||
// Equipment
|
// Equipment
|
||||||
script += 'INSERT INTO "Equipment" ("Studio_id", name, usage_price, usage_type, delivery_price, delivery_date) ' + Values(() => {
|
script += 'INSERT INTO "Equipment" ("Studio_id", name, usage_price, usage_type, delivery_price, delivery_date) ' + Values(() => {
|
||||||
return `(${GenInt(1, COUNT + 1)}, 'оборудование ${GenMaxUInt(100)}', ${GenPrice(300)}, '${EquipmentUsageTypes[GenMaxUInt(EquipmentUsageTypes.length)]}', ${GenPrice(200)}, ${GenTimestamp()})`
|
return `(${GenInt(1, COUNT + 1)}, 'оборудование ${GenMaxUInt(100)}', ${GenPrice(300)}, '${UsageTypes[GenMaxUInt(UsageTypes.length)]}', ${GenPrice(200)}, ${GenTimestamp()})`
|
||||||
})
|
})
|
||||||
|
|
||||||
// Class_Equipment
|
// Class_Equipment
|
||||||
|
|||||||
20
4/schema.sql
20
4/schema.sql
@ -1,6 +1,12 @@
|
|||||||
DROP TABLE IF EXISTS "Person", "Client", "Master", "Studio", "Course", "Class", "Class_Master", "Registration", "FoodProductEnum", "FoodProduct", "Equipment", "Class_Equipment", "DrugEnum", "Drug", "DrugIntolerance", "ActivityLog";
|
DROP TABLE IF EXISTS "Person", "Client", "Master", "Studio", "Course", "Class", "Class_Master", "Registration", "FoodProductEnum", "FoodProduct", "Equipment", "Class_Equipment", "DrugEnum", "Drug", "DrugIntolerance", "ActivityLog";
|
||||||
|
|
||||||
DROP TYPE IF EXISTS "ClassType", "RegistrationStatus", "EquipmentUsageType";
|
DROP TYPE IF EXISTS "ClassType", "RegistrationStatus", "UsageType";
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TYPE "UsageType" AS ENUM (
|
||||||
|
'PayOnce',
|
||||||
|
'PayMonthly'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE "Person" (
|
CREATE TABLE "Person" (
|
||||||
@ -40,7 +46,9 @@ CREATE TABLE "Studio" (
|
|||||||
address text UNIQUE NOT NULL,
|
address text UNIQUE NOT NULL,
|
||||||
capacity int NOT NULL CHECK (capacity > 0),
|
capacity int NOT NULL CHECK (capacity > 0),
|
||||||
begin_date timestamptz NOT NULL,
|
begin_date timestamptz NOT NULL,
|
||||||
duration interval NOT NULL
|
duration interval NOT NULL,
|
||||||
|
usage_price real NOT NULL,
|
||||||
|
usage_type "UsageType" NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -154,18 +162,12 @@ CREATE TABLE "FoodProduct" (
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
CREATE TYPE "EquipmentUsageType" AS ENUM (
|
|
||||||
'PayOnce',
|
|
||||||
'PayMonthly'
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE "Equipment" (
|
CREATE TABLE "Equipment" (
|
||||||
id int GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
id int GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
|
||||||
"Studio_id" int,
|
"Studio_id" int,
|
||||||
name text NOT NULL,
|
name text NOT NULL,
|
||||||
usage_price real NOT NULL,
|
usage_price real NOT NULL,
|
||||||
usage_type "EquipmentUsageType" NOT NULL,
|
usage_type "UsageType" NOT NULL,
|
||||||
delivery_price real NOT NULL,
|
delivery_price real NOT NULL,
|
||||||
delivery_date timestamptz NOT NULL,
|
delivery_date timestamptz NOT NULL,
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user