SUrvey now works

This commit is contained in:
2024-11-17 19:41:30 +01:00
parent 51b0641702
commit e75de81e39
13 changed files with 1210 additions and 201 deletions

View File

@@ -26,7 +26,8 @@ func InitDB() {
}
func createTables() {
companyTable := `
tables := []string{
`
CREATE TABLE IF NOT EXISTS Company (
id INTEGER PRIMARY KEY AUTOINCREMENT,
UUID TEXT NOT NULL,
@@ -34,9 +35,9 @@ func createTables() {
TaxId TEXT NOT NULL,
Email TEXT NOT NULL,
Password TEXT NOT NULL
);`
);`,
basicProfileTable := `
`
CREATE TABLE IF NOT EXISTS BasicProfile (
id INTEGER PRIMARY KEY AUTOINCREMENT,
CompanyId INTEGER,
@@ -57,37 +58,33 @@ func createTables() {
API TEXT,
VendorAccess TEXT,
InternalDev TEXT,
GeoScope TEXT, -- Geographic operational scope
CustomerBase TEXT, -- Customer base distribution
CustomerType TEXT, -- Primary customer type
ProductPortfolio TEXT, -- Product/service portfolio
SupplierBase TEXT, -- Supplier base structure
ITInfrastructure TEXT, -- IT infrastructure model (comma-separated values)
IPProtection TEXT, -- Intellectual property protection (comma-separated values)
SensitiveData TEXT, -- Sensitive data types (comma-separated values)
IntegrationLevel TEXT, -- Integration level of business systems
RemotePolicy TEXT, -- Remote work policy
FOREIGN KEY (CompanyId) REFERENCES Company(id)
);`
);`,
advancedProfileTable := `
CREATE TABLE IF NOT EXISTS AdvancedProfile (
`CREATE TABLE IF NOT EXISTS Session (
id INTEGER PRIMARY KEY AUTOINCREMENT,
CompanyId INTEGER,
GeographicDistribution TEXT,
CustomerConcentration TEXT,
ProductServicePortfolio TEXT,
OrganizationalCulture TEXT,
SupplierDiversity TEXT,
TechnologicalInfrastructure TEXT,
IntellectualProperty TEXT,
ManagementTeamExperience TEXT,
FOREIGN KEY (CompanyId) REFERENCES Company(id)
);`
key TEXT NOT NULL,
value TEXT NOT NULL
);`,
_, err := db.Exec(companyTable)
if err != nil {
log.Fatalf("Error creating Company table: %v", err)
`CREATE INDEX IF NOT EXISTS idx_session_key ON Session(key);`,
}
_, err = db.Exec(basicProfileTable)
if err != nil {
log.Fatalf("Error creating BasicProfile table: %v", err)
}
_, err = db.Exec(advancedProfileTable)
if err != nil {
log.Fatalf("Error creating AdvancedProfile table: %v", err)
for _, table := range tables {
_, err := db.Exec(table)
if err != nil {
log.Fatalf("Error creating table: %v", err)
}
}
}